Skip to Content
Embedded Programming with Modern C++ Cookbook
book

Embedded Programming with Modern C++ Cookbook

by Igor Viarheichyk
April 2020
Intermediate to advanced
412 pages
9h 58m
English
Packt Publishing
Content preview from Embedded Programming with Modern C++ Cookbook

How it works...

When you run the binary, you will see the following output:

In this simple program, we're simulating communication with an external device. Since we don't have a real device, the SendDataToDevice function just prints the size of the data it is supposed to send to the target device.

Suppose the device can operate on chunks of data of a variable size. Each chunk of data is prepended by its size and encoded as a 32-bit unsigned integer. This can be described as follows:

Size Payload
0-4 bytes 5 - N bytes, where N is Size

 

In our code, we declare size as uint32_t:

  uint32_t size = sizeof(buffer);

This means that it will ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C++ System Programming Cookbook

C++ System Programming Cookbook

Onorato Vaticone
C++ Cookbook

C++ Cookbook

D. Ryan Stephens, Christopher Diggins, Jonathan Turkanis, Jeff Cogswell

Publisher Resources

ISBN: 9781838821043Supplemental Content