paho mqtt on wago? [message #1753327] |
Fri, 03 February 2017 16:15  |
Eclipse User |
|
|
|
My college has installed forte on the wago according to the documentation. This worked.
However, we are also needing mqtt.
Has anybody already cross compiled the paho mqtt for wago and could provide the settings?
In the documentation:
1. checkout and build MQTT Paho on Linux or Linux Virtual Machine:
> sudo apt-get install libssl-dev
> git clone https://github.com/eclipse/paho.mqtt.c.git
> cd org.eclipse.paho.mqtt.c.git
> cd <phao src code>
> make
start CMake on Linux or Linux Virtual Machine as you usually do to configure FORTE and follow the next steps:
2.
check FORTE_COM_PHAOMQTT in CMake
set FORTE_COM_PHAOMQTT folder in CMake
configure CMake until nothing is marked red afterwards generate with CMake.
build forte
1. would be compiled native while 2. is cross compiled. Therefore there is an error message at linking them together.
|
|
|
|
|
|
|
|
Re: paho mqtt on wago? [message #1754446 is a reply to message #1753896] |
Fri, 17 February 2017 16:19   |
Eclipse User |
|
|
|
In the meantime we cross compiled it, but it does not work.
Publish1/Subscribe1 say "invalid id" or "terminated", which also is displayed if we write any trash into "ID" of the PUBLISH1 FB. Publish and subscribe programs supplied as Paho examples work on the wago. Starting forte, there is no error.
The connect-function of the paho mqtt layer is never called.
Unfortunately there are many possibilities for making errors but forte compiles and links and there is no helpful errormessage and the logfile is empty.
Here some errors which occured:
- in CMakeList of paho, "mqtt" is set "OFF" by default, which we did not recognise. There is no error message, forte is linked, the project is deployed
- Accidentally we linked the i386 version of the paho libs. There is an error in the output of the ptxdist logfile, but the forte binary was produced. There was no error after deploy.
- the paho directory in the setting for forte was wrong once but forte was linked.
- the mqtt computer has 2 ip addresses, if you use both, paho is not working
|
|
|
Re: paho mqtt on wago? [message #1754447 is a reply to message #1754446] |
Fri, 17 February 2017 16:20   |
Eclipse User |
|
|
|
On my computer w/o cross compiler I found in the generated bin directory the code presented below.
The constructor of MQTTComLayer was not called on the forte for wago.
But it was compiled. And paho libs was linked (2 of them, withoud ssl).
I cannot access the computer with the ptxdist cross compiler now, but we can look on Monday, if this code was generated there also.
The CMakeList of the forte paho was adjusted:
forte_add_network_layer(PAHOMQTT OFF "mqtt" MQTTComLayer MQTTComLayer "Enable Paho MQTT Com Layer")
was changed to "ON"
forte_add_link_library( paho-mqtt3a.so paho-mqtt3as.so paho-mqtt3c.so paho-mqtt3cs.so)
was changed:
forte_add_link_library( paho-mqtt3a.so paho-mqtt3c.so)
Here the above mentioned source code:
CComLayer* CComLayersManager::createCommunicationLayer(char *pa_acLayerIdentifier, CComLayer* pa_poUpperLayer, CCommFB * pa_poComFB){
CComLayer* m_poNewLayer = 0;
if(false){}
else if(0 == strcmp("fbdk", pa_acLayerIdentifier)){
m_poNewLayer = new CFBDKASN1ComLayer(pa_poUpperLayer, pa_poComFB);
}
else if(0 == strcmp("ip", pa_acLayerIdentifier)){
m_poNewLayer = new CIPComLayer(pa_poUpperLayer, pa_poComFB);
}
else if(0 == strcmp("loc", pa_acLayerIdentifier)){
m_poNewLayer = new CLocalComLayer(pa_poUpperLayer, pa_poComFB);
}
else if(0 == strcmp("raw", pa_acLayerIdentifier)){
m_poNewLayer = new CRawDataComLayer(pa_poUpperLayer, pa_poComFB);
}
else if(0 == strcmp("json", pa_acLayerIdentifier)){
m_poNewLayer = new CJsonComLayer(pa_poUpperLayer, pa_poComFB);
}
else if(0 == strcmp("mqtt", pa_acLayerIdentifier)){
m_poNewLayer = new MQTTComLayer(pa_poUpperLayer, pa_poComFB);
}
return m_poNewLayer;
}
[Updated on: Fri, 17 February 2017 16:41] by Moderator
|
|
|
|
|
|
|
|
Re: paho mqtt on wago? [message #1754915 is a reply to message #1754869] |
Thu, 23 February 2017 17:34  |
Eclipse User |
|
|
|
This is really strange that the ptxdist build is producing a different result. Would be interesting to find out the cause. But good that you have some workaround for you.
Both are arm processors with linux so the binary compatibility seams reasonable.
|
|
|
Powered by
FUDForum. Page generated in 0.34055 seconds