|
| 1 | +Programming manual |
| 2 | +================== |
1 | 3 |
|
2 | 4 | Examples of programmation |
3 | 5 | ------------------------- |
4 | 6 |
|
5 | 7 | TODO: Write a manual |
6 | 8 |
|
| 9 | +POPSensor.ph |
| 10 | +POPSensorData.h |
| 11 | + |
7 | 12 | ### main_example.cpp |
8 | 13 | This file contains the a simple example on how to uses the different classes of the POPWin project. The main code of this examples is: |
9 | 14 |
|
@@ -43,3 +48,46 @@ To compile and run this example use: |
43 | 48 | make |
44 | 49 | popcrun objects.map ./main resources.json |
45 | 50 |
|
| 51 | +Main parallel classes |
| 52 | +--------------------- |
| 53 | +This chapter describes in more details the main classes used in this project. |
| 54 | + |
| 55 | +### POPSensor parallel class |
| 56 | +POPSensor is the primary class to use in a POPWin application. It allows the user to access the remote sensors. Its main methods are: |
| 57 | + |
| 58 | +- **Constructor**: specifies the name of the JSON file that describes resources and start acquiring data from the remote sensors. |
| 59 | +- **Gather** : returns the data that was gathered in the form of a POPSensorData object. |
| 60 | +- **Broadcast** : broadcast one message to all sensors |
| 61 | + |
| 62 | +[Full definition](POPSensor.ph). |
| 63 | + |
| 64 | +### SensorProxy parallel class |
| 65 | +One POPSensor object can connect to one or many POPSensor class. This second class handles the communication with the gateway sensor. The POPSensor object will create one POPSensor for each gateway sensor connected on USB. This is transparent to the programmer so this class should not be used directly. |
| 66 | + |
| 67 | +[Full definition](SensorProxy.ph). |
| 68 | + |
| 69 | +### POPSensorData class |
| 70 | +A POPSensorData object is returned by the Gather() method. It contains all the data collected by the sensors including: |
| 71 | + |
| 72 | +- Sensor id |
| 73 | +- Time stamp |
| 74 | +- Measurement type |
| 75 | +- Measurement unit |
| 76 | + |
| 77 | +Additionally this class provides the mothods: |
| 78 | + |
| 79 | +- **Print** : Prints the data to the standard output |
| 80 | +- **PrintToFile** : Outputs the data to a file in .csv format |
| 81 | +- **Clear** : Clears the data |
| 82 | +- **GetSize** : Returns the number of records |
| 83 | +- **Insert**: Insert new data into the structure |
| 84 | +- **Reduce**: Compute and returns statistics on the data (size, min, max, aver, sum, stdev) |
| 85 | + |
| 86 | +[Full definition](POPSensorData.h). |
| 87 | + |
| 88 | + |
| 89 | +Limitations |
| 90 | +----------- |
| 91 | +Broadcast of messages TODO |
| 92 | +Different firmwares for sensors |
| 93 | + |
0 commit comments