Exemplo n.º 1
0
//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);
}
Exemplo n.º 2
0
//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);
}
Exemplo n.º 3
0
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);
}
Exemplo n.º 4
0
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);

}
Exemplo n.º 6
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);
}
Exemplo n.º 7
0
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);
}
Exemplo n.º 8
0
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");
    }
}
Exemplo n.º 9
0
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);
}
Exemplo n.º 10
0
pnlTxRF::pnlTxRF(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size, int styles, wxString idname)
{
	BuildContent(parent,id,pos,size);
}
Exemplo n.º 11
0
dlgRefClk::dlgRefClk(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
	BuildContent(parent,id,pos,size);
}
Exemplo n.º 12
0
ExpressionTester::ExpressionTester( wxWindow* parent, FileContentBase* content, FileContentBase::OffsetT current )
{
    m_Content = content;
    m_Current = current;
	BuildContent(parent);
}
Exemplo n.º 13
0
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);
}
Exemplo n.º 14
0
dlgAbout::dlgAbout(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
	BuildContent(parent,id,pos,size);
}
Exemplo n.º 15
0
dlgMarkers::dlgMarkers(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
    initialized = false;
    BuildContent(parent,id,pos,size);
}
Exemplo n.º 16
0
dlgVcoCapLog::dlgVcoCapLog(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
{
	BuildContent(parent,id,pos,size);
}
Exemplo n.º 17
0
pnlFreqTable::pnlFreqTable(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size, int style, wxString name)
{
	BuildContent(parent,id,pos,size);
}
Exemplo n.º 18
0
dlgGFIR_Coefficients::dlgGFIR_Coefficients(wxWindowID id,const wxPoint& pos,const wxSize& size)
{
    lmsControl = NULL;
	BuildContent(id,pos,size);
}
Exemplo n.º 19
0
pnlCDS::pnlCDS(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size, int style, wxString name)
{
    lmsControl = NULL;
    BuildContent(parent,id,pos,size);
    AssignEnumsToIds();
}
Exemplo n.º 20
0
pnlSPI::pnlSPI(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size, int style, wxString name):
    PluginPanel(this)
{
    m_serPort = NULL;
    BuildContent(parent, id);
}