repositories
/
deb_libcec.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
win32: download boost deps from xbmc.org
[deb_libcec.git]
/
src
/
lib
/
AdapterCommunication.h
diff --git
a/src/lib/AdapterCommunication.h
b/src/lib/AdapterCommunication.h
index 71688301351c89d84428d63b31d319d90fc76706..2ec6e3b60c3481597f22b6f4894dc6ec6f16bbca 100644
(file)
--- a/
src/lib/AdapterCommunication.h
+++ b/
src/lib/AdapterCommunication.h
@@
-40,18
+40,27
@@
namespace CEC
{
namespace CEC
{
+ typedef enum cec_adapter_message_state
+ {
+ ADAPTER_MESSAGE_STATE_UNKNOWN = 0,
+ ADAPTER_MESSAGE_STATE_WAITING,
+ ADAPTER_MESSAGE_STATE_SENT,
+ ADAPTER_MESSAGE_STATE_RECEIVED,
+ ADAPTER_MESSAGE_STATE_ERROR
+ } cec_adapter_message_state;
+
+
class CCECAdapterMessage : public boost::enable_shared_from_this<CCECAdapterMessage>
{
public:
class CCECAdapterMessage : public boost::enable_shared_from_this<CCECAdapterMessage>
{
public:
- CCECAdapterMessage(void) {}
+ CCECAdapterMessage(void) {
clear();
}
CCECAdapterMessage(const cec_command &command);
CCECAdapterMessage(const cec_command &command);
- CCECAdapterMessage &operator =(const CCECAdapterMessage &msg);
bool empty(void) const { return packet.empty(); }
uint8_t operator[](uint8_t pos) const { return packet[pos]; }
uint8_t at(uint8_t pos) const { return packet[pos]; }
uint8_t size(void) const { return packet.size; }
bool empty(void) const { return packet.empty(); }
uint8_t operator[](uint8_t pos) const { return packet[pos]; }
uint8_t at(uint8_t pos) const { return packet[pos]; }
uint8_t size(void) const { return packet.size; }
- void clear(void) { packet.clear(); }
+ void clear(void) {
state = ADAPTER_MESSAGE_STATE_UNKNOWN;
packet.clear(); }
void shift(uint8_t iShiftBy) { packet.shift(iShiftBy); }
void push_back(uint8_t add) { packet.push_back(add); }
cec_adapter_messagecode message(void) const { return packet.size >= 1 ? (cec_adapter_messagecode) (packet.at(0) & ~(MSGCODE_FRAME_EOM | MSGCODE_FRAME_ACK)) : MSGCODE_NOTHING; }
void shift(uint8_t iShiftBy) { packet.shift(iShiftBy); }
void push_back(uint8_t add) { packet.push_back(add); }
cec_adapter_messagecode message(void) const { return packet.size >= 1 ? (cec_adapter_messagecode) (packet.at(0) & ~(MSGCODE_FRAME_EOM | MSGCODE_FRAME_ACK)) : MSGCODE_NOTHING; }
@@
-61,7
+70,13
@@
namespace CEC
cec_logical_address destination(void) const { return packet.size >= 2 ? (cec_logical_address) (packet.at(1) & 0xF) : CECDEVICE_UNKNOWN; };
void push_escaped(int16_t byte);
cec_logical_address destination(void) const { return packet.size >= 2 ? (cec_logical_address) (packet.at(1) & 0xF) : CECDEVICE_UNKNOWN; };
void push_escaped(int16_t byte);
- cec_datapacket packet;
+ cec_datapacket packet;
+ cec_adapter_message_state state;
+ CMutex mutex;
+ CCondition condition;
+
+ private:
+ CCECAdapterMessage &operator =(const CCECAdapterMessage &msg);
};
typedef boost::shared_ptr<CCECAdapterMessage> CCECAdapterMessagePtr;
};
typedef boost::shared_ptr<CCECAdapterMessage> CCECAdapterMessagePtr;
@@
-96,7
+111,8
@@
namespace CEC
CLibCEC * m_controller;
CecBuffer<uint8_t> m_inBuffer;
CecBuffer<CCECAdapterMessagePtr> m_outBuffer;
CLibCEC * m_controller;
CecBuffer<uint8_t> m_inBuffer;
CecBuffer<CCECAdapterMessagePtr> m_outBuffer;
- CMutex m_
bufferM
utex;
+ CMutex m_
m
utex;
CCondition m_rcvCondition;
CCondition m_rcvCondition;
+ CCondition m_startCondition;
};
};
};
};