cec: drop shared_ptr and use a normal pointer. removed boost dependency
[deb_libcec.git] / src / lib / CECProcessor.cpp
index e24d81246b2f5d07b4cc38103b0549b219570c49..563f2aa13a1c4cba31bf74155219e3d5fe5721c3 100644 (file)
@@ -231,13 +231,17 @@ cec_power_status CCECProcessor::GetDevicePowerStatus(cec_logical_address iAddres
 
 bool CCECProcessor::Transmit(const cec_command &data)
 {
+  bool bReturn(false);
   LogOutput(data);
 
-  CCECAdapterMessagePtr output(new CCECAdapterMessage(data));
-  return Transmit(output);
+  CCECAdapterMessage *output = new CCECAdapterMessage(data);
+  bReturn = Transmit(output);
+  delete output;
+
+  return bReturn;
 }
 
-bool CCECProcessor::Transmit(CCECAdapterMessagePtr output)
+bool CCECProcessor::Transmit(CCECAdapterMessage *output)
 {
   bool bReturn(false);
   CLockObject lock(&m_mutex);
@@ -300,6 +304,8 @@ bool CCECProcessor::WaitForTransmitSucceeded(uint8_t iLength, uint32_t iTimeout
 
     if ((bError = msg.is_error()) == false)
     {
+      m_controller->AddLog(bError ? CEC_LOG_WARNING : CEC_LOG_DEBUG, msg.ToString());
+
       switch(msg.message())
       {
       case MSGCODE_COMMAND_ACCEPTED:
@@ -385,7 +391,7 @@ void CCECProcessor::SetCurrentButton(cec_user_control_code iButtonCode)
 
 void CCECProcessor::AddCommand(const cec_command &command)
 {
-//  m_controller->AddCommand(command);
+  m_controller->AddCommand(command);
 }
 
 void CCECProcessor::AddKey(void)
@@ -400,11 +406,12 @@ void CCECProcessor::AddLog(cec_log_level level, const CStdString &strMessage)
 
 bool CCECProcessor::SetAckMask(uint16_t iMask)
 {
+  bool bReturn(false);
   CStdString strLog;
   strLog.Format("setting ackmask to %2x", iMask);
   m_controller->AddLog(CEC_LOG_DEBUG, strLog.c_str());
 
-  CCECAdapterMessagePtr output(new CCECAdapterMessage);
+  CCECAdapterMessage *output = new CCECAdapterMessage;
 
   output->push_back(MSGSTART);
   output->push_escaped(MSGCODE_SET_ACK_MASK);
@@ -412,11 +419,10 @@ bool CCECProcessor::SetAckMask(uint16_t iMask)
   output->push_escaped((uint8_t)iMask);
   output->push_back(MSGEND);
 
-  if (!Transmit(output))
-  {
+  if ((bReturn = Transmit(output)) == false)
     m_controller->AddLog(CEC_LOG_ERROR, "could not set the ackmask");
-    return false;
-  }
 
-  return true;
+  delete output;
+
+  return bReturn;
 }