void OTGWBase::ParseLine() { if (m_bufferpos<2) return; std::string sLine((char*)&m_buffer); std::vector<std::string> results; StringSplit(sLine,",",results); if (results.size()==25) { //status report //0 Status (MsgID=0) - Printed as two 8-bit bitfields //1 Control setpoint (MsgID=1) - Printed as a floating point value //2 Remote parameter flags (MsgID= 6) - Printed as two 8-bit bitfields //3 Maximum relative modulation level (MsgID=14) - Printed as a floating point value //4 Boiler capacity and modulation limits (MsgID=15) - Printed as two bytes //5 Room Setpoint (MsgID=16) - Printed as a floating point value //6 Relative modulation level (MsgID=17) - Printed as a floating point value //7 CH water pressure (MsgID=18) - Printed as a floating point value //8 Room temperature (MsgID=24) - Printed as a floating point value //9 Boiler water temperature (MsgID=25) - Printed as a floating point value //10 DHW temperature (MsgID=26) - Printed as a floating point value //11 Outside temperature (MsgID=27) - Printed as a floating point value //12 Return water temperature (MsgID=28) - Printed as a floating point value //13 DHW setpoint boundaries (MsgID=48) - Printed as two bytes //14 Max CH setpoint boundaries (MsgID=49) - Printed as two bytes //15 DHW setpoint (MsgID=56) - Printed as a floating point value //16 Max CH water setpoint (MsgID=57) - Printed as a floating point value //17 Burner starts (MsgID=116) - Printed as a decimal value //18 CH pump starts (MsgID=117) - Printed as a decimal value //19 DHW pump/valve starts (MsgID=118) - Printed as a decimal value //20 DHW burner starts (MsgID=119) - Printed as a decimal value //21 Burner operation hours (MsgID=120) - Printed as a decimal value //22 CH pump operation hours (MsgID=121) - Printed as a decimal value //23 DHW pump/valve operation hours (MsgID=122) - Printed as a decimal value //24 DHW burner operation hours (MsgID=123) - Printed as a decimal value _tOTGWStatus _status; int idx=0; _status.MsgID=results[idx++]; if (_status.MsgID.size()==17) { bool bCH_enabled=(_status.MsgID[7]=='1'); UpdateSwitch(101,bCH_enabled,"CH_enabled"); bool bDHW_enabled=(_status.MsgID[6]=='1'); UpdateSwitch(102,bDHW_enabled,"DHW_enabled"); bool bCooling_enable=(_status.MsgID[5]=='1'); UpdateSwitch(103,bCooling_enable,"Cooling_enable"); bool bOTC_active=(_status.MsgID[4]=='1'); UpdateSwitch(104,bOTC_active,"OTC_active"); bool bCH2_enabled=(_status.MsgID[3]=='1'); UpdateSwitch(105,bCH2_enabled,"CH2_enabled"); bool bFault_indication=(_status.MsgID[9+7]=='1'); UpdateSwitch(110,bFault_indication,"Fault_indication"); bool bCH_active=(_status.MsgID[9+6]=='1'); UpdateSwitch(111,bCH_active,"CH_active"); bool bDHW_active=(_status.MsgID[9+5]=='1'); UpdateSwitch(112,bDHW_active,"DHW_active"); bool bFlameOn=(_status.MsgID[9+4]=='1'); UpdateSwitch(113,bFlameOn,"FlameOn"); bool bCooling_Mode_Active=(_status.MsgID[9+3]=='1'); UpdateSwitch(114,bCooling_Mode_Active,"Cooling_Mode_Active"); bool bCH2_Active=(_status.MsgID[9+2]=='1'); UpdateSwitch(115,bCH2_Active,"CH2_Active"); bool bDiagnosticEvent=(_status.MsgID[9+1]=='1'); UpdateSwitch(116,bDiagnosticEvent,"DiagnosticEvent"); } _status.Control_setpoint=(float)atof(results[idx++].c_str()); UpdateTempSensor(idx-1,_status.Control_setpoint,"Control Setpoint"); _status.Remote_parameter_flags=results[idx++]; _status.Maximum_relative_modulation_level=(float)atof(results[idx++].c_str()); _status.Boiler_capacity_and_modulation_limits=results[idx++]; _status.Room_Setpoint=(float)atof(results[idx++].c_str()); UpdateSetPointSensor(idx-1,_status.Room_Setpoint,"Room Setpoint"); _status.Relative_modulation_level=(float)atof(results[idx++].c_str()); _status.CH_water_pressure=(float)atof(results[idx++].c_str()); if (_status.CH_water_pressure!=0) { UpdatePressureSensor(idx-1,_status.CH_water_pressure,"CH Water Pressure"); } _status.Room_temperature=(float)atof(results[idx++].c_str()); UpdateTempSensor(idx-1,_status.Room_temperature,"Room Temperature"); _status.Boiler_water_temperature=(float)atof(results[idx++].c_str()); UpdateTempSensor(idx-1,_status.Boiler_water_temperature,"Boiler Water Temperature"); _status.DHW_temperature=(float)atof(results[idx++].c_str()); UpdateTempSensor(idx-1,_status.DHW_temperature,"DHW Temperature"); _status.Outside_temperature=(float)atof(results[idx++].c_str()); UpdateTempSensor(idx-1,_status.Outside_temperature,"Outside Temperature"); _status.Return_water_temperature=(float)atof(results[idx++].c_str()); UpdateTempSensor(idx-1,_status.Return_water_temperature,"Return Water Temperature"); _status.DHW_setpoint_boundaries=results[idx++]; _status.Max_CH_setpoint_boundaries=results[idx++]; _status.DHW_setpoint=(float)atof(results[idx++].c_str()); UpdateSetPointSensor(idx-1,_status.DHW_setpoint,"DHW Setpoint"); _status.Max_CH_water_setpoint=(float)atof(results[idx++].c_str()); UpdateSetPointSensor(idx-1,_status.Max_CH_water_setpoint,"Max_CH Water Setpoint"); _status.Burner_starts=atol(results[idx++].c_str()); _status.CH_pump_starts=atol(results[idx++].c_str()); _status.DHW_pump_valve_starts=atol(results[idx++].c_str()); _status.DHW_burner_starts=atol(results[idx++].c_str()); _status.Burner_operation_hours=atol(results[idx++].c_str()); _status.CH_pump_operation_hours=atol(results[idx++].c_str()); _status.DHW_pump_valve_operation_hours=atol(results[idx++].c_str()); _status.DHW_burner_operation_hours=atol(results[idx++].c_str()); return; } else { if (sLine=="SE") { _log.Log(LOG_ERROR,"OTGW: Error received!"); } else { if ( (sLine.find("OT")==std::string::npos)&& (sLine.find("PS")==std::string::npos) ) { //Dont report OT/PS feedback _log.Log(LOG_STATUS,"OTGW: %s",sLine.c_str()); } } } }
void OTGWBase::ParseLine() { if (m_bufferpos<2) return; std::string sLine((char*)&m_buffer); std::vector<std::string> results; StringSplit(sLine,",",results); if (results.size()==25) { //status report //0 Status (MsgID=0) - Printed as two 8-bit bitfields //1 Control setpoint (MsgID=1) - Printed as a floating point value //2 Remote parameter flags (MsgID= 6) - Printed as two 8-bit bitfields //3 Maximum relative modulation level (MsgID=14) - Printed as a floating point value //4 Boiler capacity and modulation limits (MsgID=15) - Printed as two bytes //5 Room Setpoint (MsgID=16) - Printed as a floating point value //6 Relative modulation level (MsgID=17) - Printed as a floating point value //7 CH water pressure (MsgID=18) - Printed as a floating point value //8 Room temperature (MsgID=24) - Printed as a floating point value //9 Boiler water temperature (MsgID=25) - Printed as a floating point value //10 DHW temperature (MsgID=26) - Printed as a floating point value //11 Outside temperature (MsgID=27) - Printed as a floating point value //12 Return water temperature (MsgID=28) - Printed as a floating point value //13 DHW setpoint boundaries (MsgID=48) - Printed as two bytes //14 Max CH setpoint boundaries (MsgID=49) - Printed as two bytes //15 DHW setpoint (MsgID=56) - Printed as a floating point value //16 Max CH water setpoint (MsgID=57) - Printed as a floating point value //17 Burner starts (MsgID=116) - Printed as a decimal value //18 CH pump starts (MsgID=117) - Printed as a decimal value //19 DHW pump/valve starts (MsgID=118) - Printed as a decimal value //20 DHW burner starts (MsgID=119) - Printed as a decimal value //21 Burner operation hours (MsgID=120) - Printed as a decimal value //22 CH pump operation hours (MsgID=121) - Printed as a decimal value //23 DHW pump/valve operation hours (MsgID=122) - Printed as a decimal value //24 DHW burner operation hours (MsgID=123) - Printed as a decimal value _tOTGWStatus _status; int idx=0; _status.MsgID=results[idx++]; if (_status.MsgID.size()==17) { bool bCH_enabled=(_status.MsgID[7]=='1'); UpdateSwitch(101,bCH_enabled,"CH_enabled"); bool bDHW_enabled=(_status.MsgID[6]=='1'); UpdateSwitch(102,bDHW_enabled,"DHW_enabled"); bool bCooling_enable=(_status.MsgID[5]=='1'); UpdateSwitch(103,bCooling_enable,"Cooling_enable"); bool bOTC_active=(_status.MsgID[4]=='1'); UpdateSwitch(104,bOTC_active,"OTC_active"); bool bCH2_enabled=(_status.MsgID[3]=='1'); UpdateSwitch(105,bCH2_enabled,"CH2_enabled"); bool bFault_indication=(_status.MsgID[9+7]=='1'); UpdateSwitch(110,bFault_indication,"Fault_indication"); bool bCH_active=(_status.MsgID[9+6]=='1'); UpdateSwitch(111,bCH_active,"CH_active"); bool bDHW_active=(_status.MsgID[9+5]=='1'); UpdateSwitch(112,bDHW_active,"DHW_active"); bool bFlameOn=(_status.MsgID[9+4]=='1'); UpdateSwitch(113,bFlameOn,"FlameOn"); bool bCooling_Mode_Active=(_status.MsgID[9+3]=='1'); UpdateSwitch(114,bCooling_Mode_Active,"Cooling_Mode_Active"); bool bCH2_Active=(_status.MsgID[9+2]=='1'); UpdateSwitch(115,bCH2_Active,"CH2_Active"); bool bDiagnosticEvent=(_status.MsgID[9+1]=='1'); UpdateSwitch(116,bDiagnosticEvent,"DiagnosticEvent"); } _status.Control_setpoint = static_cast<float>(atof(results[idx++].c_str())); SendTempSensor(idx - 1, 255, _status.Control_setpoint, "Control Setpoint"); _status.Remote_parameter_flags=results[idx++]; _status.Maximum_relative_modulation_level = static_cast<float>(atof(results[idx++].c_str())); bool bExists = CheckPercentageSensorExists(idx - 1, 1); if ((_status.Maximum_relative_modulation_level != 0) || (bExists)) { SendPercentageSensor(idx - 1, 1, 255, _status.Maximum_relative_modulation_level, "Maximum Relative Modulation Level"); } _status.Boiler_capacity_and_modulation_limits=results[idx++]; _status.Room_Setpoint = static_cast<float>(atof(results[idx++].c_str())); UpdateSetPointSensor(idx - 1, ((m_OverrideTemperature!=0.0f) ? m_OverrideTemperature : _status.Room_Setpoint), "Room Setpoint"); _status.Relative_modulation_level = static_cast<float>(atof(results[idx++].c_str())); bExists = CheckPercentageSensorExists(idx - 1, 1); if ((_status.Relative_modulation_level != 0) || (bExists)) { SendPercentageSensor(idx - 1, 1, 255, _status.Relative_modulation_level, "Relative modulation level"); } _status.CH_water_pressure = static_cast<float>(atof(results[idx++].c_str())); if (_status.CH_water_pressure != 0) { SendPressureSensor(0, idx - 1, 255, _status.CH_water_pressure, "CH Water Pressure"); } _status.Room_temperature = static_cast<float>(atof(results[idx++].c_str())); SendTempSensor(idx - 1, 255, _status.Room_temperature, "Room Temperature"); _status.Boiler_water_temperature = static_cast<float>(atof(results[idx++].c_str())); SendTempSensor(idx - 1, 255, _status.Boiler_water_temperature, "Boiler Water Temperature"); _status.DHW_temperature = static_cast<float>(atof(results[idx++].c_str())); SendTempSensor(idx - 1, 255, _status.DHW_temperature, "DHW Temperature"); _status.Outside_temperature = static_cast<float>(atof(results[idx++].c_str())); SendTempSensor(idx - 1, 255, _status.Outside_temperature, "Outside Temperature"); _status.Return_water_temperature = static_cast<float>(atof(results[idx++].c_str())); SendTempSensor(idx - 1, 255, _status.Return_water_temperature, "Return Water Temperature"); _status.DHW_setpoint_boundaries=results[idx++]; _status.Max_CH_setpoint_boundaries=results[idx++]; _status.DHW_setpoint = static_cast<float>(atof(results[idx++].c_str())); UpdateSetPointSensor(idx - 1, _status.DHW_setpoint, "DHW Setpoint"); _status.Max_CH_water_setpoint = static_cast<float>(atof(results[idx++].c_str())); UpdateSetPointSensor(idx - 1, _status.Max_CH_water_setpoint, "Max_CH Water Setpoint"); _status.Burner_starts=atol(results[idx++].c_str()); _status.CH_pump_starts=atol(results[idx++].c_str()); _status.DHW_pump_valve_starts=atol(results[idx++].c_str()); _status.DHW_burner_starts=atol(results[idx++].c_str()); _status.Burner_operation_hours=atol(results[idx++].c_str()); _status.CH_pump_operation_hours=atol(results[idx++].c_str()); _status.DHW_pump_valve_operation_hours=atol(results[idx++].c_str()); _status.DHW_burner_operation_hours=atol(results[idx++].c_str()); return; } else { if (sLine=="SE") { _log.Log(LOG_ERROR,"OTGW: Error received!"); } else if (sLine.find("PR: G")!=std::string::npos) { _tOTGWGPIO _GPIO; _GPIO.A=static_cast<int>(sLine[6]- '0'); // if (_GPIO.A==0 || _GPIO.A==1) // { UpdateSwitch(96,(_GPIO.A==1),"GPIOAPulledToGround"); // } // else // { // Remove device (how?) // } _GPIO.B=static_cast<int>(sLine[7]- '0'); // if (_GPIO.B==0 || _GPIO.B==1) // { UpdateSwitch(97,(_GPIO.B==1),"GPIOBPulledToGround"); // } // else // { // Remove device (how?) // } } else if (sLine.find("PR: I")!=std::string::npos) { _tOTGWGPIO _GPIO; _GPIO.A=static_cast<int>(sLine[6]- '0'); UpdateSwitch(98,(_GPIO.A==1),"GPIOAStatusIsHigh"); _GPIO.B=static_cast<int>(sLine[7]- '0'); UpdateSwitch(99,(_GPIO.B==1),"GPIOBStatusIsHigh"); } else if (sLine.find("PR: O")!=std::string::npos) { // Check if setpoint is overriden m_OverrideTemperature=0.0f; char status=sLine[6]; if (status == 'c' || status == 't') { // Get override setpoint value m_OverrideTemperature=static_cast<float>(atof(sLine.substr(7).c_str())); } } else if (sLine.find("PR: A") != std::string::npos) { //Gateway Version std::string tmpstr = sLine.substr(6); size_t tpos = tmpstr.find(' '); if (tpos != std::string::npos) { m_Version = tmpstr.substr(tpos + 9); } } else { if ( (sLine.find("OT") == std::string::npos)&& (sLine.find("PS") == std::string::npos)&& (sLine.find("SC") == std::string::npos) ) { //Dont report OT/PS/SC feedback _log.Log(LOG_STATUS,"OTGW: %s",sLine.c_str()); } } } }