GetInstance()->MessageBox("Communication with Z-Wave module was lost while sending command.nCheck the cable and either retry the operation or restart the application.","Error");
break;
case CSerialAPI::COMM_NO_RESPONSE:
GetInstance()->MessageBox("Communication with Z-Wave module timed out while waiting for response.nCheck the cable and either retry the operation or restart the application.","Error");
break;
default:
GetInstance()->MessageBox("Communication with Z-Wave module was lost.nCheck the cable and either retry the operation or restart the application.","Error");
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
this_instance = this;
this_hWnd = m_hWnd;
/* Start the Z-Wave initilization*/
/* Find out which port is connected.*/
bMaxNodeID = 0;
PortValue = 0;
libType = 0;
#if _MSC_VER >= 1300
bySpeed = CSerialAPI::SPEED_115200;
#else
bySpeed = CSerialAPI.SPEED_115200;
#endif
lSpeed = 115200;
for (int i = 1; i < __argc; i++)
{
LPCTSTR pszParam = __argv[i];
if (pszParam[0] == '-' || pszParam[0] == '/')
{
++pszParam;
}
if (lstrcmpi(pszParam,"com=1") == 0)
PortValue = 1;
else if (lstrcmpi(pszParam,"com=2") == 0)
PortValue = 2;
else if (lstrcmpi(pszParam,"com=3") == 0)
PortValue = 3;
else if (lstrcmpi(pszParam,"com=4") == 0)
PortValue = 4;
else if (lstrcmpi(pszParam,"com=5") == 0)
PortValue = 5;
else if (lstrcmpi(pszParam,"com=6") == 0)
PortValue = 6;
else if (lstrcmpi(pszParam,"com=7") == 0)
PortValue = 7;
if (lstrcmpi(pszParam,"speed=19200") == 0)
{
#if _MSC_VER >= 1300
bySpeed = CSerialAPI::SPEED_19200;
#else
bySpeed = CSerialAPI.SPEED_19200;
#endif
lSpeed = 19200;
}
else if (lstrcmpi(pszParam,"speed=57600") == 0)
{
#if _MSC_VER >= 1300
bySpeed = CSerialAPI::SPEED_57600;
#else
bySpeed = CSerialAPI.SPEED_57600;
#endif
lSpeed = 57600;
}
if (FindLib(PortValue,bySpeed) == 0)
{
api.Shutdown();
str.Format("This application requires a static controller Z-Wave module connected to the serialport.nnDownload the correct Serial API code to the Z-Wave Module and restart the application.");
}
}
if (__argc < 2)
{
m_txtStatus.SetWindowText("No nodes added to controller");
if (api.Initialize(PortValue, bySpeed, ApplicationCommandHandler, CommErrorNotification))
{
libType = api.ZW_Version((BYTE*)uCversion); //Get the lib type and version from module
switch (libType)
{
case ZW_NO_INTELLIGENT_LIFE:
{
api.Shutdown();
str.Format("No Serial API code detected on port: com%d - check serial connections.nThis application requires an Installer version of the Serial APInon a Z-Wave module connected via a serialport.nDownload the correct Serial API code to the Z-Wave Module and restart the application.", PortValue);
}
break;
case ZW_LIB_CONTROLLER_STATIC:
{
api.Shutdown();
str.Format("Controller based serial API code detected on port: com%d.nThis application requires an Installer version of the Serial APInon a Z-Wave module connected via a serialport.nDownload the correct Serial API code to the Z-Wave Module and restart the application.", PortValue);
}
break;
case ZW_LIB_CONTROLLER:
{
api.Shutdown();
str.Format("Controller based serial API code detected on port: com%d.nThis application requires an Installer version of the Serial APInon a Z-Wave module connected via a serialport.nDownload the correct Serial API code to the Z-Wave Module and restart the application.", PortValue);
}
break;
case ZW_LIB_SLAVE_ENHANCED:
{
api.Shutdown();
str.Format("Enhanced Slave based serial API code detected on port: com%d.nThis application requires an Installer version of the Serial APInon a Z-Wave module connected via a serialport.nDownload the correct Serial API code to the Z-Wave Module and restart the application.", PortValue);
}
break;
case ZW_LIB_SLAVE:
{
api.Shutdown();
str.Format("Slave based serial API code detected on port: com%d.nThis application requires an Installer version of the Serial APInon a Z-Wave module connected via a serialport.nDownload the correct Serial API code to the Z-Wave Module and restart the application.", PortValue);
str.Format("This application requires an Installer version of the Z-Wave module connected to the serialport.nnDownload the correct Serial API code to the Z-Wave Module and restart the application.");