X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Flib%2FLibCECC.cpp;h=91ab395eca5fa61e30657bbede26abb8c4d2757e;hb=e2800c154cf5ce325adf02f7473ce4686962f383;hp=a637a8314d248d590057641754bee3904ae71cc5;hpb=f2cdbc3683e19fa58e5311e4020c0420901cfed5;p=deb_libcec.git diff --git a/src/lib/LibCECC.cpp b/src/lib/LibCECC.cpp index a637a83..91ab395 100644 --- a/src/lib/LibCECC.cpp +++ b/src/lib/LibCECC.cpp @@ -74,6 +74,13 @@ void cec_close(void) cec_parser->Close(); } +int cec_enable_callbacks(void *cbParam, ICECCallbacks *callbacks) +{ + if (cec_parser) + return cec_parser->EnableCallbacks(cbParam, callbacks) ? 1 : 0; + return -1; +} + int8_t cec_find_adapters(cec_adapter *deviceList, uint8_t iBufSize, const char *strDevicePath /* = NULL */) { if (cec_parser) @@ -95,7 +102,7 @@ int cec_start_bootloader(void) return -1; } -int8_t cec_get_min_version(void) +int8_t cec_get_min_lib_version(void) { if (cec_parser) return cec_parser->GetMinLibVersion(); @@ -247,6 +254,27 @@ uint64_t cec_get_device_vendor_id(cec_logical_address iLogicalAddress) return 0; } +uint16_t cec_get_device_physical_address(cec_logical_address iLogicalAddress) +{ + if (cec_parser) + return cec_parser->GetDevicePhysicalAddress(iLogicalAddress); + return 0; +} + +cec_logical_address cec_get_active_source(void) +{ + if (cec_parser) + return cec_parser->GetActiveSource(); + return CECDEVICE_UNKNOWN; +} + +int cec_is_active_source(cec_logical_address iAddress) +{ + if (cec_parser) + return cec_parser->IsActiveSource(iAddress); + return false; +} + cec_power_status cec_get_device_power_status(cec_logical_address iLogicalAddress) { if (cec_parser) @@ -264,6 +292,7 @@ int cec_poll_device(cec_logical_address iLogicalAddress) cec_logical_addresses cec_get_active_devices(void) { cec_logical_addresses addresses; + addresses.Clear(); if (cec_parser) addresses = cec_parser->GetActiveDevices(); return addresses; @@ -283,32 +312,63 @@ int cec_is_active_device_type(cec_device_type type) return -1; } -int cec_set_hdmi_port(uint8_t iPort) +int cec_set_hdmi_port(cec_logical_address iBaseDevice, uint8_t iPort) { if (cec_parser) - return cec_parser->SetHDMIPort(iPort) ? 1 : 0; + return cec_parser->SetHDMIPort(iBaseDevice, iPort) ? 1 : 0; return -1; } -int cec_volume_up(void) +int cec_volume_up(int bSendRelease) { if (cec_parser) - return cec_parser->VolumeUp(); + return cec_parser->VolumeUp(bSendRelease == 1); return -1; } -int cec_volume_down(void) +int cec_volume_down(int bSendRelease) { if (cec_parser) - return cec_parser->VolumeDown(); + return cec_parser->VolumeDown(bSendRelease == 1); return -1; } -int cec_mute_audio(void) +int cec_mute_audio(int bSendRelease) { if (cec_parser) - return cec_parser->MuteAudio(); + return cec_parser->MuteAudio(bSendRelease == 1); return -1; } +int cec_send_keypress(cec_logical_address iDestination, cec_user_control_code key, int bWait) +{ + if (cec_parser) + return cec_parser->SendKeypress(iDestination, key, bWait == 1) ? 1 : 0; + return -1; +} + +int cec_send_key_release(cec_logical_address iDestination, int bWait) +{ + if (cec_parser) + return cec_parser->SendKeyRelease(iDestination, bWait == 1) ? 1 : 0; + return -1; +} + +cec_osd_name cec_get_device_osd_name(cec_logical_address iAddress) +{ + cec_osd_name retVal; + retVal.device = iAddress; + retVal.name[0] = 0; + + if (cec_parser) + retVal = cec_parser->GetDeviceOSDName(iAddress); + + return retVal; +} + +int cec_enable_physical_address_detection(void) +{ + return cec_parser ? (cec_parser->EnablePhysicalAddressDetection() ? 1 : 0) : -1; +} + //@}