namespace CEC
{
+ typedef enum cec_adapter_messagecode
+ {
+ MSGCODE_NOTHING = 0,
+ MSGCODE_PING,
+ MSGCODE_TIMEOUT_ERROR,
+ MSGCODE_HIGH_ERROR,
+ MSGCODE_LOW_ERROR,
+ MSGCODE_FRAME_START,
+ MSGCODE_FRAME_DATA,
+ MSGCODE_RECEIVE_FAILED,
+ MSGCODE_COMMAND_ACCEPTED,
+ MSGCODE_COMMAND_REJECTED,
+ MSGCODE_SET_ACK_MASK,
+ MSGCODE_TRANSMIT,
+ MSGCODE_TRANSMIT_EOM,
+ MSGCODE_TRANSMIT_IDLETIME,
+ MSGCODE_TRANSMIT_ACK_POLARITY,
+ MSGCODE_TRANSMIT_LINE_TIMEOUT,
+ MSGCODE_TRANSMIT_SUCCEEDED,
+ MSGCODE_TRANSMIT_FAILED_LINE,
+ MSGCODE_TRANSMIT_FAILED_ACK,
+ MSGCODE_TRANSMIT_FAILED_TIMEOUT_DATA,
+ MSGCODE_TRANSMIT_FAILED_TIMEOUT_LINE,
+ MSGCODE_FIRMWARE_VERSION,
+ MSGCODE_START_BOOTLOADER,
+ MSGCODE_GET_BUILDDATE,
+ MSGCODE_SET_CONTROLLED,
+ MSGCODE_GET_AUTO_ENABLED,
+ MSGCODE_SET_AUTO_ENABLED,
+ MSGCODE_GET_DEFAULT_LOGICAL_ADDRESS,
+ MSGCODE_SET_DEFAULT_LOGICAL_ADDRESS,
+ MSGCODE_GET_LOGICAL_ADDRESS_MASK,
+ MSGCODE_SET_LOGICAL_ADDRESS_MASK,
+ MSGCODE_GET_PHYSICAL_ADDRESS,
+ MSGCODE_SET_PHYSICAL_ADDRESS,
+ MSGCODE_GET_DEVICE_TYPE,
+ MSGCODE_SET_DEVICE_TYPE,
+ MSGCODE_GET_HDMI_VERSION,
+ MSGCODE_SET_HDMI_VERSION,
+ MSGCODE_GET_OSD_NAME,
+ MSGCODE_SET_OSD_NAME,
+ MSGCODE_WRITE_EEPROM,
+ MSGCODE_GET_ADAPTER_TYPE,
+ MSGCODE_FRAME_EOM = 0x80,
+ MSGCODE_FRAME_ACK = 0x40,
+ } cec_adapter_messagecode;
+
+ typedef enum p8_cec_adapter_type
+ {
+ P8_ADAPTERTYPE_UNKNOWN = 0,
+ P8_ADAPTERTYPE_EXTERNAL,
+ P8_ADAPTERTYPE_DAUGHTERBOARD,
+ } p8_cec_adapter_type;
+
class CCECAdapterMessage
{
public:
*/
cec_adapter_messagecode Message(void) const;
+ /*!
+ * @return The messagecode (if provided) that this message is responding to
+ */
+ cec_adapter_messagecode ResponseTo(void) const;
+
/*!
* @return True when this message is a transmission, false otherwise.
*/
bool IsACK(void) const;
/*!
- * @return True when this message has been replied with an error code, false otherwise.
+ * @brief Checks whether the given messagecode is an error message.
+ * @param code The code to check.
+ * @return True when it's an error, false otherwise.
+ */
+ static bool MessageCodeIsError(const cec_adapter_messagecode code);
+
+ /*!
+ * @return True when this message contains an error code, false otherwise.
*/
bool IsError(void) const;
+ /*!
+ * @return True when this message has been replied with an error code, false otherwise.
+ */
+ bool ReplyIsError(void) const;
+
/*!
* @return True when this message has been replied with an error code and needs to be retried, false otherwise.
*/
*/
cec_adapter_messagecode Reply(void) const;
- uint8_t maxTries; /**< the maximum number of times to try to send this message */
cec_datapacket response; /**< the response to this message */
cec_datapacket packet; /**< the actual data */
cec_adapter_message_state state; /**< the current state of this message */
int32_t transmit_timeout; /**< the timeout to use when sending this message */
uint8_t lineTimeout; /**< the default CEC line timeout to use when sending this message */
+ bool bFireAndForget; /**< true to auto delete, don't wait for a response */
private:
bool bNextByteIsEscaped; /**< true when the next byte that is added will be escaped, false otherwise */