Community news, upcoming events and general discussions
Threads: 36 Posts: 88
Get technical support from the community
Threads: 1427 Posts: 7608
Threads: 18 Posts: 64
Tell us how to make XDK better!
Threads: 36 Posts: 119
Share and discuss community member projects
Threads: 81 Posts: 350
I was trying to post data from the sensor to MS Azure through http independently (not on BOSCH IoT suite) that needs identification token to access. However, after I looked through all examples provided in XDK, I found no case that really helps. Did I miss anything useful or could you guide me out of the confusion.
Hello Michael, would you be so kind and get a little bit more into detail? What identification token are we talking about? Is it included in the HTTP body? The serval stack has its malice. There is an example HTTP POST request here. Another way would be to POST via the REST API, but it depends on your purposes. Kind regards, Manuel
Yes. It is within the http body including a specific username and password. Say for MS Azure, I attached some photoes including necessary info of the cloud we need to post data on.
EVENT HUB URL is the target URL.
ManagePolicy is the username.
KEY is the password.
The main purpose is to post data on MS Azure cloud received from XDK.
I have looked through that HTTP POST request example but I am still not clear where should I input my info about including target URL, username and password? I only see DEST_PORT_NUMBER, WLAN_CONNECT_WPA_SSID and WLAN_CONNECT_WPA_PASS that could be defined by user in provided example.
You also mentioned REST API. I have checked Azure EVENTHUB setting. It accepts HTTP POST and AMQP 1.0. So REST API should be a feasible choice for us right? Which one would be bette in case of our need?
Moreover, technically, are we be able to post data through BOSCH broker (mqtt.bosch-si.com) to cloud like MS Azure?
Hello Michael, sorry for the short delay. First of all, let me clarify where to register the destination URL. The example code that I posted in the other thread is based on the HttpExampleClient, that you can find on the welcome screen of the XDK workbench. You need to implement my example code in HttpExampleClient.c. The URL function is the following:
If you can’t find the function instantly, just use ctrl + H, go to C/C++ Search and search for “PAL_getIpaddress”. In general, I would say the REST API provides an easier interface to make HTTP requests to a server. With the REST API you simply need to set a pointer to the payload in the RestClient_ReqInfo_T struct. In comparison to the HTTP API POST request example, I haven’t tested it right now, but it should work. If it may help you, I can share my complete example http post project with you on github. Relating to the direct post trough BOSCH broker to the MS Azure cloud: We are unable to do this. Technically it is possible but would require a implementation on the server itself. Please let me know, if this helps. Kind regards, Manuel
I appreciate a lot. I will try now with use of REST API.
Additionally, I was wondering the reason why BOSCH broker cannot communicate with Azure?
Is it due to the limitation set by BOSCH broker like topics, identity, client ID and etc. necessary but unknown for user's further implementation?
Meanwhile, because XDK could not connect to Azure through BOSCH broker, we are trying to achieve the connection through other brokers (like Mosquitto broker but just for test use now). However, it involves some settings for things like topic, username, password. How could we make implementation over them with BOSCH IoT Suite?
Hello Michael, maybe there is a small missunderstanding. Do you want to post the data from the mqtt broker to MS Azure via HTTP or do you want to subscribe as a mqtt client and get the measurements published of the broker? Wouldn’t it be better to post the data directly from the XDK to MS Azure, as you are planning to do it? (independently if you post via mqtt or http) - Manuel
I think we have some misunderstanding here. Let me reclarify them.
For now, we have two options for data delivering from XDK to server.
1. Through HTTP from XDK directly to server
Thank you for your help. I have found the place to change URL. However, it seems that I also need to set SAS key for a complete and secure HTTP request. Could you tell me where could I find it?
2. Through MQTT (XDK-> MQTT Broker->Subscriber)
I would like to try two paths through MQTT.
As you said, the problem lying in this path is that BOSCH Broker doesn't provide the functionality for users to subscribe data but all data would be consumed by BOSCH web app (those charts and data visualizations on web). Correct me if I was not right. This is our first concern.
The problem lying in this path happens from XDK to Mosquitto Broker. As I understand, technically, we need hostaddress, port#, topic, message and etc. for publishers to complete simple publishments. I find settings of hostaddress as well as port# in CFG_parser_ih.h and those of topics in MQTT_Client_ch.h. We have achieved the publishments of other publishers (not XDK) through Mosquitto Broker but the question is how are we supposed to change these parameters in IoT Suites in order to publish data to Mosquitto Broker?
Hello Michael, 1. I’m not sure about SAS, this is a proprietary MS Authentication, right? The functionality of encrypted requests is not supported right now and in addition currently there is no possibility to set the header of the request. The header will be automatically generated by the serval stack, I’m really sorry for this. 2. I will ask the developers of the broker, if there is a possibility to subscribe and keep you posted here. 3. I am aware of the fact, that there is no documentation about how to set up mqtt with the XDK and the only possibility is to adapt an example. But the good news are, our developers are working hard to improve the whole documentation and examples. I would suggest you to take a look at the mqtt paho example that is much smaller than the IoT in order to publish data to the Mosquitto Broker. I hope this could help you. Kind regards, Manuel
I have the same issue as Michael, i.e. we want to push data from the XDK directly to the Azure IoT Hub.
Please forgive my ignorance; perhaps what I'm asking is not very sensible.
Microsoft has the following SDK: Microsoft Azure IoT device SDK for C. If I were to incorporate this SDK into the Bosch Eclipse XDK development environment and create source code that leverages both the XDK SDK and the MS SDK and if all compiles and builds well, will I be able to safely flash the XDK with the resulting build? I don't want to brick the device by accident.
Hello Evren, the Microsoft Azure SDK is an abstract interface in C. The XDK environment is build up with integration possibilities like this. If you successfully integrate the Microsoft SDK, you will be able to flash it. This will have no impacts on the stability of the XDK. Note: be carful with changes in the XDK SDK. The SDK is linked to each project. That is why we recommend to make the changes only in the project files. Kind regards, Manuel
I was trying to use http post request but I am geting some errors like "error occurred in downloading HTML "
can you please share the github project with me so that I can use it for my xdk.
Hello Anand, the error “error occured in downloading HTML” occurs, if the server doesn’t respond to the GET or POST request. You can take a look at my project here: https://github.com/appropos-de/xdk-examples.git As I told you in the other thread, HTTP is only one possibility to get the measured values to the server. HTTP has a big overhead and you should only use it, if you really need to. Please tell me, if you are able to post. Kind regards, Manuel
Thanks for sharing the project !
I will have a look on this Tomorrow when I am back to office. Meanwhile can you suggest me which solution is best to solve my issue.
Current scenario -
I am able to connect my xdk to the Bosch dashboard and also see the sensor data there. But my need is to make my own web application and access the sensor data wirelessly so I am approaching to the http request.
any better suggestion will be a great help
Hello Anand, let me know if you make any progress with the http request. I will reply in the other tread which solution would be the best for your use case. Kind regards, Manuel
Hello, i got new information. It is possible to subscribe to the IoT server. See here - Manuel
Any working sample code for XDK send data to Azure IoT Hub using MQTT ?
Welcome to the XDK community.
I recommend to take a look at the project exchange slider. Other members of the XDK community provide their useful codes if they like to share it.
Otherwise you can also use the search function of the XDK community and check for your related topic, maybe someone posted useful code there as well.
In addition we provide a MQTT guide to explain MQTT on the XDK in general and provide a good starting point to build your own MQTT implementation.
Please tell me if this is helpful and do not hesitate to ask if you have further questions.
Kind regards, Franjo