O'Reilly logo

Home Automation with Intel Galileo by Onur Dundar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Wrapping up the message parsing system

We have added new sensors to the Smart Home application. In order to handle all incoming messages correctly, we need to be able to parse messages correctly to inform the user. When we added new command classes, we needed to handle their values separately. A part of the message parser, which handles sensor commands, is shown here. We also used a part of this in the previous chapter to handle energy meter values such as illumination and temperature:

int parse_incoming_mesage(uint8_t* message, int length) { //Message Length uint8_t length_of_rest = message[1]; uint8_t message_type = message[2]; uint8_t message_function = message[3]; else if (message_function == RESPONSE_RECEIVED) { printf("Response From "); if ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required