ncsi: return command response from sendOemCommand
Rather than expecting the response to be handled from the command
callback, return it as the return value from sendOemCommand().
This addresses the todo in the sendOemCommand implementation.
Change-Id: I144128f50341d4ff7d8e248cb4dfa1427ead515b
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
diff --git a/src/ncsi_util.hpp b/src/ncsi_util.hpp
index 452c916..048bb71 100644
--- a/src/ncsi_util.hpp
+++ b/src/ncsi_util.hpp
@@ -42,6 +42,8 @@
struct Interface
{
+ using ncsiMessage = std::span<const unsigned char>;
+
/* @brief This function will ask underlying NCSI driver
* to send an OEM command (command type 0x50) with
* the specified payload as the OEM data.
@@ -51,10 +53,10 @@
* @param[in] channel - Channel number with in the package.
* @param[in] opcode - NCSI Send Command sub-operation
* @param[in] payload - OEM data to send.
- * @returns 0 on success and negative value for failure.
+ * @returns the NCSI response message to this command, or no value on error.
*/
- int sendOemCommand(int package, int channel, int opcode,
- std::span<const unsigned char> payload);
+ std::optional<std::vector<unsigned char>> sendOemCommand(
+ int package, int channel, int opcode, ncsiMessage payload);
/* @brief This function will ask underlying NCSI driver
* to set a specific package or package/channel