X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2FCECParserC.cpp;h=7deb982920866b62f31428f71020c1bf2a1543bc;hb=3fcd38dcd9f704c307da815f39c23f3e0581ef3e;hp=1aae849a7815f47550ee9784d726b0afeb1c32ba;hpb=df7339c665f732faedee7c1d3cde816cc41e3302;p=deb_libcec.git diff --git a/src/lib/CECParserC.cpp b/src/lib/CECParserC.cpp index 1aae849..7deb982 100644 --- a/src/lib/CECParserC.cpp +++ b/src/lib/CECParserC.cpp @@ -47,13 +47,6 @@ bool cec_init(const char *strDeviceName, cec_logical_address iLogicalAddress /* return (cec_parser != NULL); } -bool cec_close(void) -{ - delete cec_parser; - cec_parser = NULL; - return true; -} - bool cec_open(const char *strPort, int iTimeout) { if (cec_parser) @@ -61,6 +54,17 @@ bool cec_open(const char *strPort, int iTimeout) return false; } +bool cec_close(int iTimeout) +{ + bool bReturn = false; + if (cec_parser) + bReturn = cec_parser->Close(iTimeout); + + delete cec_parser; + cec_parser = NULL; + return bReturn; +} + bool cec_ping(void) { if (cec_parser) @@ -124,17 +128,31 @@ bool cec_get_next_keypress(cec_keypress *key) return false; } -bool cec_transmit(const CEC::cec_frame &data, bool bWaitForAck /* = true */, int64_t iTimeout /* = 2000 */) +bool cec_get_next_command(cec_command *command) +{ + if (cec_parser) + return cec_parser->GetNextCommand(command); + return false; +} + +bool cec_transmit(const CEC::cec_frame &data, bool bWaitForAck /* = true */) +{ + if (cec_parser) + return cec_parser->Transmit(data, bWaitForAck); + return false; +} + +bool cec_set_logical_address(cec_logical_address iLogicalAddress) { if (cec_parser) - return cec_parser->Transmit(data, bWaitForAck, iTimeout); + return cec_parser->SetLogicalAddress(iLogicalAddress); return false; } -bool cec_set_ack_mask(uint16_t ackmask) +bool cec_set_ack_mask(uint16_t iMask) { if (cec_parser) - return cec_parser->SetAckMask((cec_logical_address) ackmask); + return cec_parser->SetAckMask(iMask); return false; }