Code not updating
응답
18. 11. 14 오전 4:03

Hello everyone,

I am currently working to improve a code to continuously send accelerometer and gyroscope values to a database. I have been given a code that already fetch data with REST services to a database. 

But my problem is that even though I have edited the code in the XDk workbench, when I flash it onto the bosch XDK i can see it prints out the old code outputs like if my changes didn't changes anything inside the code.

Any help will be appreciated,

Thank you

Phil

0 (0 투표)
RE: Code not updating
응답
18. 11. 14 오후 8:56 as a reply to Philibert de Broglie.
Hello Phil,

did you rebuild your code after your editing?
Otherwise you might have flashed your previous unedited code to your XDK, which would explain the behavior you describe.

Also, please be sure you edited and flashed the code within the source code of your chosen project and not by mistaken to a different project's source code, which you also could have opened in the XDK-Workbench.

So, before you flash, be sure, the edited source code belongs to your project and also you selected the right project, which is to flash within the Project Explorer and, very important, to build the chosen project before flashing it.
To prevent flashing the wrong project I would always recommend to close all other projects in your workspace.
In addition, before you initialize the flashing process, I recommend to send your XDK manually into the bootloader mode.
This can be done by turning off the XDK, holding button one pressed and turning the XDK on again. Release button one after turning on the XDK and your XDK should connect to the XDK-Workbench in bootloader mode, ready to be flashed.

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Franjo
0 (0 투표)
RE: Code not updating
응답
18. 11. 15 오전 8:20 as a reply to Franjo Stjepandic.

Hello Franjo,

 

First of all thank you for your quick answer and tips !

 

And yes i have been building my project before flashing it making sure it is the correct project as well. I'm not sure what you mean by "you edited and flashed the code within the source code of your chosen project" but as i always build and flash the correct code I think i am doing it right.

I am now always making sure to be in bootloader mode, thanks for that but as the problem is still present i have decided to rewrite the entire code into a new project using the XdkApplicationTemplate as a base and called it 'Essai' in a new workspace called 'WS', and when building i get this type of error message, maybe you could help me out on this one.

"

make[1]: *** No rule to make target `/Users/philibertdebroglie/Documents/WS/Essai/debug/objects/XdkApplicationTemplate.o', needed by `/Users/philibertdebroglie/Documents/WS/Essai/debug/XdkApplicationTemplate.out'.  Stop.

make: *** [debug] Error 2

"

Kind regards,

 

Phil

0 (0 투표)
RE: Code not updating
응답
18. 11. 15 오후 11:06 as a reply to Philibert de Broglie.
Hello Phil,

I assume that this error results from an issue with your project folder path.

Could you provide me a screenshot of the environment variables you are using?
To access these properties, please click on the XDK-Workbench top menu File , select Properties .
Within the new opened popup window, browse to C/C++ Builder , followed by a click on Environment .
You will see a table of variables, values and their origin.
This is exactly the information, I require. Would you post this information in a screenshot?

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Franjo
0 (0 투표)
RE: Code not updating
응답
18. 11. 16 오전 3:38 as a reply to Franjo Stjepandic.

Hello Franjo,

 

I think the error was coming from the way I called my folders, when i changed it,  the error disapeared but still got some other errors while building the code such as "

/Users/philibertdebroglie/Documents/WS/StreamSensorDataOverREST/debug/objects/./../Platform/Utils/source/RSM_retargetStdioMessage/retargetio.d:1: *** target pattern contains no `%'.  Stop.

make: *** [debug] Error 2

"

Please Find attach the Screenshot.

 

Kind Regards,

Phil

0 (0 투표)
RE: Code not updating
응답
18. 11. 19 오후 2:15 as a reply to Philibert de Broglie.
Hello Phil,
you are right, that the error results from the folders.
*** target pattern contains no `%' is a badly written message from make. It means "one of your filenames had a character that could be part of a regular expression".
Could you please check your folder paths again and make sure that there is no character messing with make?

In addition could you provide me a screenshot of the entire error message you receive?

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Franjo
0 (0 투표)
RE: Code not updating
응답
18. 11. 20 오전 8:24 as a reply to Franjo Stjepandic.

Hello Franjo,

 

So currently I am writting on two things, The code i was given that we have been talking about. (which won't update and shows the following error message in the console.

"

/Users/philibertdebroglie/Documents/new/Original/final_code_v1/StreamSensorDataOverREST/debug/objects/./../Platform/Utils/source/RSM_retargetStdioMessage/retargetio.d:1: *** target pattern contains no `%'.  Stop.

make: *** [clean] Error 2

"

And I also have started to write a new code on the side as it might be quicker. And i got some different erro which i dont have a clue why it appear, i will also share a screenshot.

 

I don't know how to "make sure that there is no character messing with make", where can I check this ?

Thanks for you help

Kind regards,

Phil

0 (0 투표)
RE: Code not updating
응답
18. 11. 20 오후 4:31 as a reply to Philibert de Broglie.
Hello Phil,

thank you for providing the screenshot and also for trying several things.

Regarding the error you showed me in the latest screenshot, I assume, that the error is the missing , in line 86 (Compare it to line 93).

Anyway, I suggest you to try it with a different way.
The naming of the XdkApplicationTemplate.c signals me, that you are running an older version of the XDK-Workbench.

The SDK from XDK-Workbench version 3.3.1 to XDK-Workbench version 3.4.0 improved due to many changes.

By installing the latest XDK-Workbench version, the current issues might be gone.

After installing the latest XDK-Workbench, please be sure to start with a clean, new XDK-Workspace and, to prevent further issues, do not import projects from earlier XDK-Workbenches into the new Workspace.
The SDK changed and could result in errors with earlier projects.

You better create a new XdkApplicationTemplate from the XDK-Workbench 3.4.0 and then adapt this to your needs.

Please let me know if this was helpful and feel free to ask if you have further questions.

Kind regards,
Franjo
0 (0 투표)
RE: Code not updating
응답
18. 11. 23 오전 4:44 as a reply to Franjo Stjepandic.

Hi Franjo,

 

Okkay I have now downloaded the 3.4.0 XDK version and started working with it. But therefore have started my project all over again. I am investing the development of HttpExampleClient and the BoschXDKCloudConnectivity projects, in order to send XDK's accelerator and gyroscope data via post function to a database stored in a cloud server. 

Thank you for the help you provided me with. I might ask you some more if I face some new issues.

Kind regards,

Phil

0 (0 투표)
RE: Code not updating
응답
18. 11. 23 오전 10:15 as a reply to Philibert de Broglie.

I have been working over the HttpExampleClient project, and i have run the project after settting my wifi configuration. And it seems to work as the console outputs shows it. But Can i observe any kind of results on the postman-echo.com website?

Furthermore, I would like to ask you, if i want to push some sensors data to a database in a cloud server, I have to use POST request using the REST API is that it ? 

Kind regards

Phil

0 (0 투표)
RE: Code not updating
응답
18. 11. 23 오후 2:37 as a reply to Philibert de Broglie.
Hello Phil,
yes you can receive a response after a successful transfer of data to the server.
Depending on the serversided implementation, different data is returned. I recommend you to read the docs of the Postan Echo service here . Especially the chapter request methods is important.

Regarding your second question:
This depends on the cloud server. A server that supports the REST API will accept data from the POST request.
Please tell me if this was helpful, and do not hesitate to ask further questions.


Kind regards,
Franjo
0 (0 투표)
RE: Code not updating
응답
18. 11. 28 오전 10:46 as a reply to Franjo Stjepandic.

Hello franjo,

Once again, I want to thank you for the help.

So right now I am trying to send the accelerometer and gyroscope data to a database in a server.

I have started to implement the Post method by following The http exalmple and guide. However, I am quite unsure of how should I "insert" the data from the sensors into the payload ? Any tips on how i could do so correctly ? 

Kind Regards,

Phil

0 (0 투표)
RE: Code not updating
응답
18. 11. 28 오후 4:50 as a reply to Philibert de Broglie.
Hello Phil,

in regards to adding sensor data to the payload, I recommend you to use a JSON string, you can build this as follows:
 
const char *jsonFormat = "{\"timestamp\":\"%d\", \"temperature\":\"%d\"}";
int Length = snprintf(http_buffer, HTTP_BUFFER_SIZE, jsonFormat,(int) timeStampValue,temperatureValue);
uint16_t payloadLength = (uint16_t) strlen(payload);

Please note, that the buffer jsonFormat holds your actual JSON format and that the temperature and timestamp data is then serialized over the function snprintf() into the buffer http_buffer , which should be send out via your POST requests. The variable HTTP_BUFFER_SIZE holds the fixed length of the http_buffer , while the variable length holds the actual elements within the buffer.

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Franjo
+1 (1 투표)
RE: Code not updating
응답
18. 11. 29 오전 7:25 as a reply to Franjo Stjepandic.

Hi Franjo,

Thank you for that hint ! it helps a lot

Writting over the HttpExampleClient code i have made several changes to achieve my needs.

So what I did is that I've copied the bit of code you gave me at the top of my code (should it be somewhere else?? ) and I get errors with this line of code "

uint16_t payloadLength = (uint16_t) strlen(payload);

"

It says the "initializer element is not constant" which I am not sure what it means, plus I have declared payload as follow: "static char payload[4000];" as it was not recognized.

 I also had to change the attribute of payload and payloadlength in this following code snipet so the POST request send the Accel and Gyroscope data, Am i doing it right ?

static HTTPRestClient_Post_T HTTPRestClientPostInfo =
        {
                .Payload = http_buffer,
                .PayloadLength = HTTP_BUFFER_SIZE,
                .Url = DEST_POST_PATH,
                .RequestCustomHeader0 = POST_REQUEST_CUSTOM_HEADER_0,
                .RequestCustomHeader1 = POST_REQUEST_CUSTOM_HEADER_1,

        }; /**< HTTP rest client POST parameters */

 

I'm still going over the code trying new things, but I think this hould be the correct way to opperate.

Thank you for your help,

kind regards,

Phil

0 (0 투표)
RE: Code not updating
응답
18. 11. 29 오후 3:03 as a reply to Philibert de Broglie.
Hello Phil,

first of all, I have to please you to keep the mentioned HTTPRestClientPostInfo structure original and do not edit it at all.
 
  • .Payload = POST_REQUEST_BODY,
  • .PayloadLength = (sizeof(POST_REQUEST_BODY) - 1U),

These two parameters have to stay the same, otherwise the HTTPExampleCLient will not work.

The code-snippet I provided you in my last post has to be implemented inside the while-loop of the AppControllerFire() function, between the AppControllerValidateWLANConnectivity() and HTTPRestClient_Post() functions.

You have to access both members, payloadLength and also payload , of the HTTPRestClientPostInfo structure individually, like shown below:
 
  • HTTPRestClientPostInfo.Payload = publishBuffer;
  • HTTPRestClientPostInfo.PayloadLength = length -1;

If you have issues or any other questions, do not hesitate to ask.

Kind regards,
Franjo
0 (0 투표)
RE: Code not updating
응답
18. 11. 30 오전 9:12 as a reply to Franjo Stjepandic.

Hello Franjo,

Am I right when I define a the start of the code as follow

"

#define HTTP_BUFFER_SIZE  UINT8_C(6) /**< Number of Accelerometer & Gyroscope axis (x, y & z) */

uint16_t http_buffer[HTTP_BUFFER_SIZE] = { 0 };

static char payload[4000];

"

Okkay so I have changed back the parameters as you advised me to do. But doesn't it mean that the "POST_REQUEST_BODY" will be sent to the server ?

In order to access both members, payloadLength and also payload I have added the lines you gave me under the ones given before, is that right ? And what does publish buffer refers to?

I also have the following error message everytime:

"

 INFO | XDK DEVICE 1: HttpRestClientRequestSentCallback: HTTP request sent successfully.

 INFO | XDK DEVICE 1: HttpRestClientPostResponseCallback: failed to get range from message. error=3202

 INFO | XDK DEVICE 1: HttpRestClientPostResponseCallback: HTTP rest client POST was successful.

"

Also Is there anyway to see the data on the server ? I am only able to see the console outputs.

Kind Regards,

Phil

0 (0 투표)
RE: Code not updating
응답
18. 11. 30 오후 1:55 as a reply to Philibert de Broglie.
Hello Phil,

the definition of the HTTP_BUFFER_SIZE is correct.

The line uint16_t http_buffer[HTTP_BUFFER_SIZE]; has to be changed in two ways. First of all, this should not be at the beginning of the implementation file, but needs to be placed into the AppControllerFire() function. Second, the datatype of the buffer should be char and not uint16_t .

Regarding the question about the variable POST_REQUEST_BODY , are you correct, its content will be sent to the HTTP server. But through the line HTTPRestClientPostInfo.Payload = http_Buffer; , you define, that the http_buffer is sent instead of the variable POST_REQUEST_BODY . Furthermore, since you already defined a payload , you can delete the declaration static char payload[4000]; .

The definition HTTPRestClientPostInfo.PayloadLength = length -1; defines the PayloadLength , which is the element for the payload length in the HTTPRestClientPostInfo struct.

The publishBuffer refers to your http_buffer , here I just used a different name.

The error 3202 from the HttpRestClientPostResponseCallback() function refers to RC_REST_BINDING_PARSING_ERROR , which tells you, that there is an issue with parsing a JSON Data Form. I assume the issue results from the post function expecting a JSON string while your payload is a integer value. With the changes above, I assume that the error will be solved.

Please let me know if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Franjo
0 (0 투표)
RE: Code not updating
응답
18. 12. 4 오전 2:20 as a reply to Franjo Stjepandic.

Hi franjo,

Thanks for your last message which was very helpful! 

I managed to get errors fixed and also was able to fit all the data i wanted into the http_buffer (I verified this by printing the buffer on the console).

I still get the error 3202,  but it doesn't seems to prevent the code to send POST request and get answers from the server. 

I have now implemented a database and am using the Xampp software that creates a local host server where my database stands, and i am trying to send my data to it. 

I have joined the errors I have now. (I have tried several things into DEST_SERVER_HOST such as 127.0.0.1, 127.0.0.1:8080, 127.0.0.1:80)

I think the error i am facing is due to the fact that I have assigned an IP adress to the DEST_SERVER_HOST in the header file instead of a server name. But I don't know how to overcome this. Is there another way to access a local host server ?

0 (0 투표)
RE: Code not updating
응답
18. 12. 4 오후 3:54 as a reply to Philibert de Broglie.
Dear Phil,

I am glad to hear that you were able to fix the errors and to fill the sensor data into the http_buffer .

In regards to the error 3203 , this error code is corresponding to the serval stack enumeration RC_REST_BINDING_PARSING_ERROR . In detail, it means that the range information cannot be extracted from the HTTP response.

Since it always gets triggered by the HTTP response, it will not interfere with the sent sensor data via the POST requests and can safely be ignored. Otherwise, I would recommend inserting the range information on the server side into the HTTP header.

In regards to sending data to your notebook/pc, the IP address 127.0.0.1 is the IPv4 address for the localhost. This address can be used to access and test running server on your notebook with an installed browser such as Firefox , Google Chrome or any other browser.

It is not the IP address your notebook/pc gets assigned within your local network and that is the reason, why the XDK is unable to send the sensor data to your notebook/pc.

To solve the issue, you would need to insert the correct IP address assigned in your local network. For that, you can simply use a network program such as Network Scanner or by using the online tool whatismyip where you also get your local IP address.

Additionally, please note that your laptop/pc would need to be in the same Wi-Fi network as the XDK to receive the XDKs HTTP requests.

Kind regards,
Franjo
0 (0 투표)
RE: Code not updating
응답
18. 12. 5 오전 11:18 as a reply to Franjo Stjepandic.

Hey Franjo,

 

Thanks for the tips, I have done what you said (and Yes I was using the same wifi for my laptop and XDK sensor).  Using the website you recommended I have set up the IP adress assigned by the local network  in the header file but I still have some errors. After trying severals things, (setting the STATIC IP parameters, I am still facing some issues) I don't know why there are still some errros with POST request.

Maybe you know what i am doing wrong here ?

Kind regards, 

Phil

0 (0 투표)