cec: sync visual studio project files. removed pthreadVC2d.dll / .lib (we're not...
authorLars Op den Kamp <lars@opdenkamp.eu>
Sun, 9 Oct 2011 12:36:27 +0000 (14:36 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Sun, 9 Oct 2011 12:36:27 +0000 (14:36 +0200)
include/CECExports.h
project/libcec.vcxproj
project/testclient.vcxproj
pthreadVC2d.dll [deleted file]
src/lib/AdapterCommunication.cpp
src/lib/CECProcessor.cpp
src/lib/platform/pthread_win32/pthreadVC2d.lib [deleted file]
src/lib/platform/timeutils.h
src/lib/platform/windows/serialport.cpp

index e5c52e3b6f784afa87560cfa3dda602c2d37c91a..e3f1b76964fd4459089711106f289c6daed0f09e 100644 (file)
@@ -353,16 +353,13 @@ namespace CEC {
     cec_datapacket      parameters;
     bool                opcode_set;
 
-    static cec_command format(cec_logical_address initiator, cec_logical_address destination, cec_opcode opcode)
+    static void format(cec_command &command, cec_logical_address initiator, cec_logical_address destination, cec_opcode opcode)
     {
-      cec_command command;
       command.clear();
       command.initiator   = initiator;
       command.destination = destination;
       command.opcode      = opcode;
       command.opcode_set  = true;
-
-      return command;
     }
 
     void push_back(uint8_t data)
index 30a88482c6c9ec79098c4dacd49b6435f19194bf..8de2bf5b10adce9a0b7893adcdb0372e9980744b 100644 (file)
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T;_WINSOCKAPI_;__STDC_CONSTANT_MACROS;__WINDOWS__;DLL_EXPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories>$(SolutionDir)..\src\lib\platform\pthread_win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <DisableSpecificWarnings>4996;4100;4309</DisableSpecificWarnings>
+      <DisableSpecificWarnings>4996;4100;4309;4505</DisableSpecificWarnings>
       <TreatWarningAsError>true</TreatWarningAsError>
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <OutputFile>$(SolutionDir)..\libcec.dll</OutputFile>
-      <AdditionalDependencies>%(AdditionalDependencies);setupapi.lib;$(SolutionDir)..\src\lib\platform\pthread_win32\pthreadVC2d.lib</AdditionalDependencies>
+      <AdditionalDependencies>%(AdditionalDependencies);setupapi.lib;$(SolutionDir)..\src\lib\platform\pthread_win32\pthreadVC2.lib</AdditionalDependencies>
       <IgnoreSpecificDefaultLibraries>libcmtd</IgnoreSpecificDefaultLibraries>
       <Version>5</Version>
     </Link>
index 42cc447cfa0e4c63cce815cb81e7f5e9b197cf75..13b32a7b2c8bb97128dfa4c14f08978a3399d672 100644 (file)
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USE_32BIT_TIME_T;_WINSOCKAPI_;__STDC_CONSTANT_MACROS;__WINDOWS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <TreatWarningAsError>true</TreatWarningAsError>
-      <DisableSpecificWarnings>4100;4309</DisableSpecificWarnings>
+      <DisableSpecificWarnings>4100;4309;4505</DisableSpecificWarnings>
     </ClCompile>
     <Link>
       <SubSystem>Console</SubSystem>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>$(ProjectDir)..\src\lib\platform\pthread_win32\pthreadVC2d.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>$(ProjectDir)..\src\lib\platform\pthread_win32\pthreadVC2.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <OutputFile>$(SolutionDir)..\cec-client.exe</OutputFile>
     </Link>
   </ItemDefinitionGroup>
diff --git a/pthreadVC2d.dll b/pthreadVC2d.dll
deleted file mode 100644 (file)
index 6fffdc4..0000000
Binary files a/pthreadVC2d.dll and /dev/null differ
index 7749911dcff667e7a2db9920a8545bdec7cda433..2ee72707773d9db64ad1fd0d53634ff16a26921d 100644 (file)
@@ -406,7 +406,7 @@ void CAdapterCommunication::FormatAdapterMessage(const cec_command &command, cec
 
   // add opcode
   packet.push_back(MSGSTART);
-  PushEscaped(packet, command.parameters.empty() ? MSGCODE_TRANSMIT_EOM : MSGCODE_TRANSMIT);
+  PushEscaped(packet, command.parameters.empty() ? (uint8_t)MSGCODE_TRANSMIT_EOM : (uint8_t)MSGCODE_TRANSMIT);
   packet.push_back((uint8_t) command.opcode);
   packet.push_back(MSGEND);
 
index 4b7b66422abb764cad1f0aeeaf7b1fa1e1ebe372..bf559065d19941190b74df568270387e299924e9 100644 (file)
@@ -125,7 +125,10 @@ bool CCECProcessor::PowerOnDevices(cec_logical_address address /* = CECDEVICE_TV
   strLog.Format("<< powering on device with logical address %d", (int8_t)address);
   m_controller->AddLog(CEC_LOG_DEBUG, strLog.c_str());
 
-  return Transmit(cec_command::format(m_iLogicalAddress, address, CEC_OPCODE_IMAGE_VIEW_ON));
+  cec_command command;
+  cec_command::format(command, m_iLogicalAddress, address, CEC_OPCODE_IMAGE_VIEW_ON);
+
+  return Transmit(command);
 }
 
 bool CCECProcessor::StandbyDevices(cec_logical_address address /* = CECDEVICE_BROADCAST */)
@@ -137,7 +140,10 @@ bool CCECProcessor::StandbyDevices(cec_logical_address address /* = CECDEVICE_BR
   strLog.Format("<< putting device with logical address %d in standby mode", (int8_t)address);
   m_controller->AddLog(CEC_LOG_DEBUG, strLog.c_str());
 
-  return Transmit(cec_command::format(m_iLogicalAddress, address, CEC_OPCODE_STANDBY));
+  cec_command command;
+  cec_command::format(command, m_iLogicalAddress, address, CEC_OPCODE_STANDBY);
+
+  return Transmit(command);
 }
 
 bool CCECProcessor::SetActiveView(void)
@@ -147,7 +153,8 @@ bool CCECProcessor::SetActiveView(void)
 
   m_controller->AddLog(CEC_LOG_DEBUG, "<< setting active view");
 
-  cec_command command = cec_command::format(m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_ACTIVE_SOURCE);
+  cec_command command;
+  cec_command::format(command, m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_ACTIVE_SOURCE);
   command.parameters.push_back((m_physicaladdress >> 8) & 0xFF);
   command.parameters.push_back(m_physicaladdress & 0xFF);
 
@@ -161,7 +168,8 @@ bool CCECProcessor::SetInactiveView(void)
 
   m_controller->AddLog(CEC_LOG_DEBUG, "<< setting inactive view");
 
-  cec_command command = cec_command::format(m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_INACTIVE_SOURCE);
+  cec_command command;
+  cec_command::format(command, m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_INACTIVE_SOURCE);
   command.parameters.push_back((m_physicaladdress >> 8) & 0xFF);
   command.parameters.push_back(m_physicaladdress & 0xFF);
 
@@ -174,7 +182,7 @@ void CCECProcessor::LogOutput(const cec_command &data)
   txStr.AppendFormat(" %02x", ((uint8_t)data.initiator << 4) + (uint8_t)data.destination);
   txStr.AppendFormat(" %02x", (uint8_t)data.opcode);
 
-  for (unsigned int iPtr = 0; iPtr < data.parameters.size; iPtr++)
+  for (uint8_t iPtr = 0; iPtr < data.parameters.size; iPtr++)
     txStr.AppendFormat(" %02x", data.parameters[iPtr]);
   m_controller->AddLog(CEC_LOG_DEBUG, txStr.c_str());
 }
@@ -215,7 +223,7 @@ bool CCECProcessor::TransmitFormatted(const cec_adapter_message &data, bool bWai
 
     while (!bGotAck && now < target)
     {
-      bGotAck = WaitForAck(&bError, (uint64_t) (target - now));
+      bGotAck = WaitForAck(&bError, (uint32_t) (target - now));
       now = GetTimeMs();
 
       if (bError && now < target)
@@ -234,7 +242,8 @@ void CCECProcessor::TransmitAbort(cec_logical_address address, cec_opcode opcode
 {
   m_controller->AddLog(CEC_LOG_DEBUG, "<< transmitting abort message");
 
-  cec_command command = cec_command::format(m_iLogicalAddress, address, CEC_OPCODE_FEATURE_ABORT);
+  cec_command command;
+  cec_command::format(command, m_iLogicalAddress, address, CEC_OPCODE_FEATURE_ABORT);
   command.parameters.push_back((uint8_t)opcode);
   command.parameters.push_back((uint8_t)reason);
 
@@ -245,7 +254,8 @@ void CCECProcessor::ReportCECVersion(cec_logical_address address /* = CECDEVICE_
 {
   m_controller->AddLog(CEC_LOG_NOTICE, "<< reporting CEC version as 1.3a");
 
-  cec_command command = cec_command::format(m_iLogicalAddress, address, CEC_OPCODE_CEC_VERSION);
+  cec_command command;
+  cec_command::format(command, m_iLogicalAddress, address, CEC_OPCODE_CEC_VERSION);
   command.parameters.push_back(CEC_VERSION_1_3A);
 
   Transmit(command);
@@ -258,7 +268,8 @@ void CCECProcessor::ReportPowerState(cec_logical_address address /*= CECDEVICE_T
   else
     m_controller->AddLog(CEC_LOG_NOTICE, "<< reporting \"Off\" power status");
 
-  cec_command command = cec_command::format(m_iLogicalAddress, address, CEC_OPCODE_REPORT_POWER_STATUS);
+  cec_command command;
+  cec_command::format(command, m_iLogicalAddress, address, CEC_OPCODE_REPORT_POWER_STATUS);
   command.parameters.push_back(bOn ? (uint8_t) CEC_POWER_STATUS_ON : (uint8_t) CEC_POWER_STATUS_STANDBY);
 
   Transmit(command);
@@ -271,7 +282,8 @@ void CCECProcessor::ReportMenuState(cec_logical_address address /* = CECDEVICE_T
   else
     m_controller->AddLog(CEC_LOG_NOTICE, "<< reporting menu state as inactive");
 
-  cec_command command = cec_command::format(m_iLogicalAddress, address, CEC_OPCODE_MENU_STATUS);
+  cec_command command;
+  cec_command::format(command, m_iLogicalAddress, address, CEC_OPCODE_MENU_STATUS);
   command.parameters.push_back(bActive ? (uint8_t) CEC_MENU_STATE_ACTIVATED : (uint8_t) CEC_MENU_STATE_DEACTIVATED);
 
   Transmit(command);
@@ -290,7 +302,8 @@ void CCECProcessor::ReportOSDName(cec_logical_address address /* = CECDEVICE_TV
   strLog.Format("<< reporting OSD name as %s", osdname);
   m_controller->AddLog(CEC_LOG_NOTICE, strLog.c_str());
 
-  cec_command command = cec_command::format(m_iLogicalAddress, address, CEC_OPCODE_SET_OSD_NAME);
+  cec_command command;
+  cec_command::format(command, m_iLogicalAddress, address, CEC_OPCODE_SET_OSD_NAME);
   for (unsigned int iPtr = 0; iPtr < strlen(osdname); iPtr++)
     command.parameters.push_back(osdname[iPtr]);
 
@@ -303,7 +316,8 @@ void CCECProcessor::ReportPhysicalAddress(void)
   strLog.Format("<< reporting physical address as %04x", m_physicaladdress);
   m_controller->AddLog(CEC_LOG_NOTICE, strLog.c_str());
 
-  cec_command command = cec_command::format(m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_REPORT_PHYSICAL_ADDRESS);
+  cec_command command;
+  cec_command::format(command, m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_REPORT_PHYSICAL_ADDRESS);
   command.parameters.push_back((uint8_t) ((m_physicaladdress >> 8) & 0xFF));
   command.parameters.push_back((uint8_t) (m_physicaladdress & 0xFF));
 
@@ -314,7 +328,8 @@ void CCECProcessor::BroadcastActiveSource(void)
 {
   m_controller->AddLog(CEC_LOG_NOTICE, "<< broadcasting active source");
 
-  cec_command command = cec_command::format(m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_ACTIVE_SOURCE);
+  cec_command command;
+  cec_command::format(command, m_iLogicalAddress, CECDEVICE_BROADCAST, CEC_OPCODE_ACTIVE_SOURCE);
   command.parameters.push_back((uint8_t) ((m_physicaladdress >> 8) & 0xFF));
   command.parameters.push_back((uint8_t) (m_physicaladdress & 0xFF));
 
@@ -334,7 +349,7 @@ bool CCECProcessor::WaitForAck(bool *bError, uint32_t iTimeout /* = 1000 */)
     cec_adapter_message msg;
     msg.clear();
 
-    if (!m_communication->Read(msg, iTimeout > 0 ? iTargetTime - iNow : 1000))
+    if (!m_communication->Read(msg, iTimeout > 0 ? (int32_t)(iTargetTime - iNow) : 1000))
     {
       iNow = GetTimeMs();
       continue;
@@ -479,8 +494,8 @@ void CCECProcessor::ParseCommand(cec_command &command)
   if (command.parameters.size > 1)
   {
     dataStr += " data:";
-    for (unsigned int iPtr = 0; iPtr < command.parameters.size; iPtr++)
-      dataStr.AppendFormat(" %02x", command.parameters[iPtr]);
+    for (uint8_t iPtr = 0; iPtr < command.parameters.size; iPtr++)
+      dataStr.AppendFormat(" %02x", (unsigned int)command.parameters[iPtr]);
   }
   m_controller->AddLog(CEC_LOG_DEBUG, dataStr.c_str());
 
diff --git a/src/lib/platform/pthread_win32/pthreadVC2d.lib b/src/lib/platform/pthread_win32/pthreadVC2d.lib
deleted file mode 100644 (file)
index 0df71c7..0000000
Binary files a/src/lib/platform/pthread_win32/pthreadVC2d.lib and /dev/null differ
index 3d9b72ff2f7a491ca9eecfca2c6bbd9322b14671..1dd454fd51a8d7167375b5df69ccbd515db0a7bd 100644 (file)
  */
 
 #include <stdint.h>
-#include <sys/time.h>
 #if defined(__APPLE__)
 #include <mach/mach_time.h>
 #include <CoreVideo/CVHostTime.h>
+#elif defined(__WINDOWS__)
+#include <time.h>
+#else
+#include <sys/time.h>
 #endif
 
 namespace CEC
index 6e1c7bdef7b0509ebf942ae09674e0c7984e8def..de2a9a394171f8c60367038cac90592953223afd 100644 (file)
@@ -173,7 +173,7 @@ int8_t CSerialPort::Write(const cec_adapter_message &data)
   if (!m_bIsOpen)
     return -1;
 
-  if (!WriteFile(m_handle, data.data, data.size, &iBytesWritten, NULL))
+  if (!WriteFile(m_handle, data.packet.data, data.size(), &iBytesWritten, NULL))
   {
     m_error = "Error while writing to COM port";
     FormatWindowsError(GetLastError(), m_error);