495 views
in System Integration by
My device receives data through USB, that should be displayed in GUI.

I would like my Device Driver to give a byte are to the GUI but native call forbids pointers.

How can a byte buffer be sent from native code to Chora?

1 Answer

0 votes
by

Hi,

in case you receive many data bytes from a device, it does not make sense to implemente a property interface within your device class. In this case, you can implement an access function to query your data bytes from the device driver.

This means, your device driver contains a C function to provide a requested byte and your device class contains a method to return the requested byte by calling the C function.

So let's assume you get a certain number of bytes via USB, e.g. some measurement values. As soon as you have received the complete data set, you can send a system event to your GUI application. Then the GUI application reads the data from the device class and updates the user interface (e.g. presents the data within a chart diagram).

The concept of system events and commands are explained in the article Device Driver and Device Class - some basics about native code and data types are explained in the article Integrating with the Device.

 

by

Thanks a lot for your answer. But in Integrating with the Device in "Data types" chapter, I see that only a few Chora data types should be exchanged. If I get a 512 bytes buffers, I don't plan to read 512 bytes one by one.

by
Well, without knowing your exact use case I can give only some ideas on how to access data in general... The best solution depends on how many data should be updated how many times.

Alternative solution:

Let's assume you are dealing with a fix buffer size (e.g. 512 bytes), then you can put an array of uint8 values within your device class. Once a data set is completely received you send a system event to the UI application. Now the UI application calls a load method within the device class (e.g. LoadDataValues()) that reads the data bytes (via native C function call) and stores the result in the data array.

So you do not need to call the method of the device class for every byte.

Does this meet your expectations?

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...