//send a data value to the cloud server for the sensor with the specified id. void ATTDevice::Send(String value, int id) { if(_mqttclient->connected() == false) { Serial.println(F("Lost broker connection,restarting")); MqttConnect(); } char* message_buff = BuildContent(value); #ifdef DEBUG //don't need to write all of this if not debugging. Serial.print(F("Publish to ")); Serial.print(id); Serial.print(" : "); #endif Serial.println(message_buff); //this value is still useful and generated anyway, so no extra cost. char* Mqttstring_buff; { int length = _clientId.length() + _deviceId.length() + 26; Mqttstring_buff = new char[length]; sprintf(Mqttstring_buff, "client/%s/out/asset/%s%c/state", _clientId.c_str(), _deviceId.c_str(), (char)(id + 48)); Mqttstring_buff[length-1] = 0; } _mqttclient->publish(Mqttstring_buff, message_buff); delay(100); //give some time to the ethernet shield so it can process everything. delete(message_buff); delete(Mqttstring_buff); }
//send a data value to the cloud server for the sensor with the specified id. void ATTDevice::Send(String value, int id) { if(_mqttclient->connected() == false) { #ifdef DEBUG Serial.println(F("Lost broker connection,restarting from send")); #endif MqttConnect(); } char* message_buff = BuildContent(value); #ifdef DEBUG //don't need to write all of this if not debugging. Serial.print(F("Publish to ")); Serial.print(id); Serial.print(": "); Serial.println(message_buff); #endif char* Mqttstring_buff; { String idStr(id); //turn it into a string, so we can easily calculate the nr of characters that the nr requires. int length = _clientId.length() + _deviceId.length() + 33 + idStr.length(); Mqttstring_buff = new char[length]; sprintf(Mqttstring_buff, "client/%s/out/device/%s/asset/%s/state", _clientId.c_str(), _deviceId.c_str(), idStr.c_str()); Mqttstring_buff[length-1] = 0; } _mqttclient->publish(Mqttstring_buff, message_buff); #ifndef FAST_MQTT //some boards like the old arduino ethernet need a little time after sending mqtt data, other boards don't. delay(100); //give some time to the ethernet shield so it can process everything. #endif delete(message_buff); delete(Mqttstring_buff); }
pnlRxVGA2::pnlRxVGA2(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size, int styles, wxString idname) { m_cVer = 2; m_cRev = 2; m_cMask = 0; BuildContent(parent,id,pos,size); }
GotoFile::GotoFile(wxWindow* parent, IncrementalSelectIterator *iterator, const wxString &title, const wxString &message) : m_handler(this, iterator) { cbAssert(parent); BuildContent(parent, iterator, title, message); }
ReopenEditorConfDLg::ReopenEditorConfDLg(wxWindow* parent) { BuildContent(parent); ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("editor")); bool isManaged = cfg->ReadBool(_T("/reopen_editor/managed"),true); XRCCTRL(*this, "rbReopenDockOrNot", wxRadioBox)->SetSelection(isManaged?1:0); }
pnlRepeater::pnlRepeater(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size) : PluginPanel(this) { mSerPort = NULL; BuildContent(parent,id,pos,size); wndId2Enum[ID_ENABLE_TX]=ENABLE_TX; wndId2Enum[ID_ENABLE_RX]=ENABLE_RX; wndId2Enum[ID_GCORRQ_TX]=GCORRQ_TX; wndId2Enum[ID_GCORRI_TX]=GCORRI_TX; wndId2Enum[ID_INSEL]=INSEL; wndId2Enum[ID_IQCORR_TX]=IQCORR_TX; wndId2Enum[ID_DCCORRI]=DCCORRI_TX; wndId2Enum[ID_DCCORRQ]=DCCORRQ_TX; wndId2Enum[ID_DC_BYP_TX]=DC_BYP_TX; wndId2Enum[ID_INVSINC_BYP_TX]=INVSINC_BYP; wndId2Enum[ID_FIR_BYP_TX]=FIR_BYP_TX; wndId2Enum[ID_GC_BYP_TX]=GC_BYP_TX; wndId2Enum[ID_PHC_BYP_TX]=PHC_BYP_TX; wndId2Enum[ID_TNCO]=TNCO; wndId2Enum[ID_GCORRQ_RX]=GCORRQ_RX; wndId2Enum[ID_GCORRI_RX]=GCORRI_RX; wndId2Enum[ID_IQCORR_RX]=IQCORR_RX; wndId2Enum[ID_DCCORR]=DCCORR; wndId2Enum[ID_FIR_BYP_RX]=FIR_BYP_RX; wndId2Enum[ID_DC_BYP_RX]=DC_BYP_RX; wndId2Enum[ID_PHC_BYP_RX]=PHC_BYP_RX; wndId2Enum[ID_GC_BYP_RX]=GC_BYP_RX; vector<cmbKeyValuePair> keyvalues; for(int i=-2048; i<=2047; ++i) keyvalues.push_back( pair<int, wxString>(i, wxString::Format("%i", i))); cmbIQCORR_TX->Set(keyvalues); cmbIQCORR_RX->Set(keyvalues); keyvalues.clear(); for(int i=0; i<2048; ++i) keyvalues.push_back( pair<int, wxString>(i, wxString::Format("%i", i))); cmbGCORRI_TX->Set(keyvalues); cmbGCORRQ_TX->Set(keyvalues); cmbGCORRI_RX->Set(keyvalues); cmbGCORRQ_RX->Set(keyvalues); keyvalues.clear(); for(int i=-128; i<128; ++i) keyvalues.push_back( pair<int, wxString>(i, wxString::Format("%i", i))); cmbDCCORRI->Set(keyvalues); cmbDCCORRQ->Set(keyvalues); keyvalues.clear(); for(int i=0; i<8; ++i) keyvalues.push_back( pair<int, wxString>(i, wxString::Format("2^%i", i+12))); cmbDCCORR->Set(keyvalues); UpdateGUI(this); int values[] = {1, 2}; rgrTNCO->SetIndexValues(values, 2); UpdateTooltips(this); }
pnlTesting::pnlTesting(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size, long style, wxString name) { lmsControl = NULL; dlgNCOSweepRx = NULL; dlgVCOSweepRx = NULL; dlgNCOSweepTx = NULL; dlgVCOSweepTx = NULL; BuildContent(parent,id,pos,size); }
pnlWFMLoader::pnlWFMLoader(ConnectionManager* pSerPort, wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size) : PluginPanel(this) { m_serPort = pSerPort; BuildContent(parent, id, pos, size); wxDir dir(wxGetCwd() + "/lms-suite_wfm"); if (!dir.IsOpened()) { dir.Make("lms-suite_wfm"); } }
frControlPanel::frControlPanel(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size) { frmMain = this; BuildContent(parent,id,pos,size); #ifndef LINUX SetIcon(wxICON(MainWinICO)); #endif //SetIcon(wxICON(aaaa)); //dSerPort = new dlgSerPort(); if (! LMAL_IsOpen()) { tbtnDownload->Enable(false); } else { tbtnDownload->Enable(true); }; ShowReferenceClk(LMAL_GetReferenceClock()); LMAL_MainSetCallbackInterfaceUpdate(UpdateInterface); }
pnlTxRF::pnlTxRF(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size, int styles, wxString idname) { BuildContent(parent,id,pos,size); }
dlgRefClk::dlgRefClk(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size) { BuildContent(parent,id,pos,size); }
ExpressionTester::ExpressionTester( wxWindow* parent, FileContentBase* content, FileContentBase::OffsetT current ) { m_Content = content; m_Current = current; BuildContent(parent); }
dlgVCO_SX::dlgVCO_SX( PLL_SX *data, PLL_CGEN *data_cgen, wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size) { pll_data = data; pll_data_cgen = data_cgen; BuildContent(parent,id,pos,size); }
dlgAbout::dlgAbout(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size) { BuildContent(parent,id,pos,size); }
dlgMarkers::dlgMarkers(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size) { initialized = false; BuildContent(parent,id,pos,size); }
dlgVcoCapLog::dlgVcoCapLog(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size) { BuildContent(parent,id,pos,size); }
pnlFreqTable::pnlFreqTable(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size, int style, wxString name) { BuildContent(parent,id,pos,size); }
dlgGFIR_Coefficients::dlgGFIR_Coefficients(wxWindowID id,const wxPoint& pos,const wxSize& size) { lmsControl = NULL; BuildContent(id,pos,size); }
pnlCDS::pnlCDS(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size, int style, wxString name) { lmsControl = NULL; BuildContent(parent,id,pos,size); AssignEnumsToIds(); }
pnlSPI::pnlSPI(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size, int style, wxString name): PluginPanel(this) { m_serPort = NULL; BuildContent(parent, id); }