Dear Technicians

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. 

Sincerely

Michael

0 (0 투표)
RE: How to send data to certain url with identification token need(e.g clou
응답
16. 6. 30 오전 10:17 as a reply to Michael Miao.

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

0 (0 투표)
RE: How to send data to certain url with identification token need(e.g clou
응답
16. 7. 1 오전 5:51 as a reply to Manuel Cerny.

Hi 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?

 

Thanks!

0 (0 투표)
RE: How to send data to certain url with identification token need(e.g clou
응답
16. 7. 4 오전 10:34 as a reply to Michael Miao.

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:
 

PAL_getIpaddress((uint8_t*)”serverURL.com”, &destAddr)
    


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

0 (0 투표)
RE: How to send data to certain url with identification token need(e.g clou
응답
16. 7. 5 오전 12:39 as a reply to Manuel Cerny.

Hi 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?

 

Sincerely

Michael

 

0 (0 투표)
RE: How to send data to certain url with identification token need(e.g clou
응답
16. 7. 5 오전 10:23 as a reply to Michael Miao.

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

0 (0 투표)
RE: How to send data to certain url with identification token need(e.g clou
응답
16. 7. 7 오전 8:13 as a reply to Manuel Cerny.

Hi 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.

  • XDK->BOSCH Broker->Subscriber (Not BOSCH web)

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.

 

  • XDK->Mosquitto Broker->Subscriber

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?

 

Sincerely

Michael

 

0 (0 투표)
RE: How to send data to certain url with identification token need(e.g clou
응답
16. 7. 7 오후 1:56 as a reply to Michael Miao.

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

0 (0 투표)
RE: How to send data to certain url with identification token need(e.g clou
응답
16. 7. 8 오후 12:49 as a reply to Manuel Cerny.

Hi,

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.

https://github.com/Azure/azure-iot-sdks/tree/master/c

Best regards,

Evren

 

0 (0 투표)
RE: How to send data to certain url with identification token need(e.g clou
응답
16. 7. 11 오후 1:03 as a reply to Evren Gursoy.

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

0 (0 투표)
RE: How to send data to certain url with identification token need(e.g clou
응답
16. 7. 13 오후 12:08 as a reply to Manuel Cerny.

Hello 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.

 

Regards,

Anand

0 (0 투표)
RE: How to send data to certain url with identification token need(e.g clou
응답
16. 7. 13 오후 2:15 as a reply to Anand Kumar.

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

0 (0 투표)
RE: How to send data to certain url with identification token need(e.g clou
응답
16. 7. 13 오후 2:56 as a reply to Manuel Cerny.

Dear 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

Regards,

Anand

0 (0 투표)
RE: How to send data to certain url with identification token need(e.g clou
응답
16. 7. 15 오전 11:10 as a reply to Anand Kumar.

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

+1 (1 투표)
RE: How to send data to certain url with identification token need(e.g clou
응답
16. 7. 22 오전 8:42 as a reply to Manuel Cerny.

Hello,

i got new information. It is possible to subscribe to the IoT server. See here

- Manuel

0 (0 투표)
RE: How to send data to certain url with identification token need(e.g clou
응답
17. 3. 15 오전 7:26 as a reply to Manuel Cerny.

Greeting,

 

Any working sample code for XDK send data to Azure IoT Hub using MQTT ?

0 (0 투표)
RE: How to send data to certain url with identification token need(e.g clou
응답
17. 3. 15 오후 5:19 as a reply to SC Snake.

Hello SC,

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

+1 (1 투표)