08-03-2021 11:05 PM
Hello everyone, I am just looking for your feedback for snipping of the C++ coding. Because bsec_get_state() and bsec_set_srare() with fread() and fwrite() example is absent from the BME68X Sensor API at the github site. Also, I am not very talented with C++, just a novice.
The program is compiled and running fine. But I am not sure if it is ACTUALLY working or not. I don’t have a debug tool to see if it is behaving appropriately. The coding is expecting to run on Raspberry Pi 4 it is using bsec_2-0-6-1_generic_release_04302021..
Here are the snipped coding with bsec gets_state() for loading state from file and is set to BSEC; Usual error check logics are removed to simplify.
>>>
bsec_state = fopen("/tmp/bme68x.state", "rb");
unit8_t = result;
result = fread(serialized_state, sizeof(unsigned char), BSEC_MAX_STATE_BLOB_SIZE, bsec_state);
bsec_result = bsec_set_state(serialized_state, n_serialized_state, work_buffer_state, n_work_buffer_state);
<<<
And here are tyhe snipped coding with bsec_set_state() and save state into the file.
>>>
bsec_state = fopen("/tmp/bme68x.state", "wb");
bsec_state = bsec_get_state(0, serialized_state, n_serialized_state, work_buffer_state, n_work_buffer_state, &n_serialized_state);
result = fwrite(serialized_state, sizeof(serialized_state), 1, bsec_state)
<<<
10-22-2021 07:19 AM
Hello nkat,
Thanks for your message. BME688 BSEC2 with C code has been supported. We gladly publish all publicly available info, but sadly are unable to share the requested info within the community. Thanks for your understanding. If you have any further requests, please visit https://www.bosch-sensortec.com/about-us/contact/contact-form, use the contact form to submit your request and please make sure you refer to the question posed in the community.