267 views
in System Integration by
Hello, i'm getting familiar with the Device Interface.

When inserting the block in the Application unit, ho do i get the device to get initialize with the application, and not when a call to that device comes from the gui?

Example: i have to toggle a led.

in the inline insert i put all the header files for the device driver.

in the device init method i initialized all the pheriperals of the device.

When a i call a slot method from a button, to modify the property associated with the led toggle in the device, the device gets initialized when called, but i need the initialization to get done before... so when i call the method that updates the property, the device init() method doesn't get called every time.

2 Answers

+1 vote
by
 
Best answer

First, if you haven't done this yet, create an autoobject in the Application Unit for your device instance. In my case, my device class is called "FHDDevice".

 

Then, Inside the Application Unit's Application class (the view), add a variable which is an instance of your device class. Initialize it during the view's Init method. See the picture below.

by
I'll try, thanks
by
But when i change page? how it will work?
by

I do not create a page in my  Application::Application view. I leave the view graphics blank, as shown above. So, if I want to start with a view called Page1, which is located in unit "MainUnit" I will have the following in my application.Init

MyDevice = Application::FHDDevice;//keeps the autoobject from getting destroyed!!!!

PresentDialog( new MainUnit::Page1, null, null, null, null, null, null, null, null, false);

So the Application page is never closed. It is always the highest page. 

Does that answer your question?

by
Yes, thanks a lot.
0 votes
by

Hi Riccardo,

please have a look to the example DeviceIntegration that you will find within most Build Environments within the folder /Examples/DeviceIntegration

It shows the integration of devices into a UI application and addresses typical questions: How to start a certain action on the target? How to get data from a device? So it demonstrates the access to the underlying hardware, e.g. accessing a LED and getting events from a hardbutton.

You can take that as a template and for further investigations.

Best regards,

Manfred.

 

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

...