Cpp

From Pluto Wiki

Jump to: navigation, search

To create your C++ project, run DCEGen, which will be in /usr/pluto/bin on Linux or \pluto\bin on Windows. Add a -d [device template id] paramter. Your device template id is shown after the description input box.

DCEGen has several other parameters referring to the templates required and other things. These all have default values however and using these defaults expects that you are running from a Pluto Source tree. If you have not already done so, obtain and extract the pluto source trunk. Enter the DCEGen directory and 'make' the executable. If you execute DCEGen -d <template id> from there it will create the new directory under the pluto src heirarchy (ie: ../<Your device template name>) and when compiling your device code it will be able to find the dependant files that it requires.

DCEGen creates a project in a folder with the same name as your device template. Look at the header and you will see data members for all the your data, with _get() and _set() functions. There are also members functions to call to fire an event. Lastly, there will be command stubs in the .cpp file for you to implement your commands. By default, they just write the command out to the console.

You will also need to build sql2cpp and run it to generate the header files.

Compile your project. DCEGen will have created both a gcc Makefile and a Visual Studio .NET 2003 project file.
Note : Put '#' in front of '<-mkr_t_compile_defines-> ' in coresponding Makefile if you get errors for 'mkr_t_compile_defines'

Next, go into the Pluto Admin Website and add an instance of this new device to your installation. Here you can specify the values for the data parameters your device needs.

You will need to restart DCE Router so it reloads the device configuration. If you used Pluto's kick-start cd or installer, DCERouter will run automatically every time you reboot. When DCERouter is running on your Core, just run run your compiled project with the paramters -d [device id] -r [ip address of the core or dce router].

Your device will connect to the router--you can see this in the router's logs. You can send your new device commands with the ***MessageSend*** utility.

Now you can add your own implementation to make the device do whatever you want. To see some of our DCE Devices, chose Download from the menu, go to the 'Source Code' section, under Manufacturer Pluto, category DCE Devices.

Personal tools