cec: added SetConfiguration()/cec_set_configuration() to the interface
[deb_libcec.git] / src / lib / LibCECC.cpp
index 5ca2885d48edeeb5425a87a3238bd2cb9bb61439..c6f1563a5cf829453b12c8ec43d70530ac610755 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the libCEC(R) library.
  *
- * libCEC(R) is Copyright (C) 2011 Pulse-Eight Limited.  All rights reserved.
+ * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited.  All rights reserved.
  * libCEC(R) is an original work, containing original code.
  *
  * libCEC(R) is a trademark of Pulse-Eight Limited.
@@ -30,8 +30,8 @@
  *     http://www.pulse-eight.net/
  */
 
-#include <cec.h>
-#include <cecc.h>
+#include "../../include/cec.h"
+#include "../../include/cecc.h"
 
 using namespace CEC;
 using namespace std;
@@ -42,15 +42,15 @@ using namespace std;
 //@{
 ICECAdapter *cec_parser;
 
-int cec_init(const char *strDeviceName, cec_logical_address iLogicalAddress, uint16_t iPhysicalAddress)
+int cec_initialise(const libcec_configuration *configuration)
 {
-  cec_parser = (ICECAdapter *) CECCreate(strDeviceName, iLogicalAddress, iPhysicalAddress);
+  cec_parser = (ICECAdapter *) CECInitialise(configuration);
   return (cec_parser != NULL) ? 1 : 0;
 }
 
-int cec_init_typed(const char *strDeviceName, cec_device_type_list devicesTypes)
+int cec_init_typed(const char *strDeviceName, cec_device_type_list deviceTypes)
 {
-  cec_parser = (ICECAdapter *) CECInit(strDeviceName, devicesTypes);
+  cec_parser = (ICECAdapter *) CECInit(strDeviceName, deviceTypes);
   return (cec_parser != NULL) ? 1 : 0;
 }
 
@@ -74,10 +74,10 @@ void cec_close(void)
     cec_parser->Close();
 }
 
-int cec_enable_callbacks(ICECCallbacks *callbacks)
+int cec_enable_callbacks(void *cbParam, ICECCallbacks *callbacks)
 {
   if (cec_parser)
-    return cec_parser->EnableCallbacks(callbacks) ? 1 : 0;
+    return cec_parser->EnableCallbacks(cbParam, callbacks) ? 1 : 0;
   return -1;
 }
 
@@ -371,4 +371,43 @@ int cec_enable_physical_address_detection(void)
   return cec_parser ? (cec_parser->EnablePhysicalAddressDetection() ? 1 : 0) : -1;
 }
 
+int cec_set_stream_path_logical(CEC::cec_logical_address iAddress)
+{
+  return cec_parser ? (cec_parser->SetStreamPath(iAddress) ? 1 : 0) : -1;
+}
+
+int cec_set_stream_path_physical(uint16_t iPhysicalAddress)
+{
+  return cec_parser ? (cec_parser->SetStreamPath(iPhysicalAddress) ? 1 : 0) : -1;
+}
+
+cec_logical_addresses cec_get_logical_addresses(void)
+{
+  cec_logical_addresses addr;
+  addr.Clear();
+  if (cec_parser)
+    addr = cec_parser->GetLogicalAddresses();
+  return addr;
+}
+
+int cec_get_current_configuration(libcec_configuration *configuration)
+{
+  return cec_parser ? (cec_parser->GetCurrentConfiguration(configuration) ? 1 : 0) : -1;
+}
+
+int cec_can_persist_configuration(void)
+{
+  return cec_parser ? (cec_parser->CanPersistConfiguration() ? 1 : 0) : -1;
+}
+
+int cec_persist_configuration(libcec_configuration *configuration)
+{
+  return cec_parser ? (cec_parser->PersistConfiguration(configuration) ? 1 : 0) : -1;
+}
+
+int cec_set_configuration(libcec_configuration *configuration)
+{
+  return cec_parser ? (cec_parser->SetConfiguration(configuration) ? 1 : 0) : -1;
+}
+
 //@}