|
3 | 3 | - **Author:** Laurent Winkler |
4 | 4 | - **Date:** Decembre 2014 |
5 | 5 |
|
6 | | -This document contains a general description of the POPWin project, specifications and examples of programmation. For a more technical documentation (installation, troubleshooting, ...) the developer documentation can be found here [here](INSTALL.md) |
| 6 | +This document contains a general description of the POPWin project, specifications and examples of programmation. |
| 7 | + |
| 8 | +1. For a more technical documentation (installation, troubleshooting, ...) the developer documentation can be found here [here](INSTALL.md). |
| 9 | +2. The full programming guide for POPWin can be found [here](PROGRAMMING.md). |
| 10 | +3. Specifications of resource description and messaging can be found [here](SPECIFICATIONS.md). |
7 | 11 |
|
8 | 12 | Contacts |
9 | 13 | -------- |
@@ -41,138 +45,8 @@ As explained in the documentation of the POPWin project the communication uses d |
41 | 45 | - **High level**: the POP model is used |
42 | 46 | - **Low level**: the publish/subscribe model is used |
43 | 47 |
|
44 | | -TODO: Add UML schemes of PK |
45 | | - |
46 | | -Examples of programmation |
47 | | -------------------------- |
48 | | - |
49 | | -TODO: Write a manual |
50 | | - |
51 | | -### main_example.cpp |
52 | | -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: |
53 | | - |
54 | | - // Create a POPSensor object on the local machine with resource description |
55 | | - POPSensor popSensor("localhost", "resource.json"); |
56 | | - |
57 | | - // Start listening to the remote sensors |
58 | | - popSensor.StartListening(); |
59 | | - |
60 | | - // wait ... |
61 | | - |
62 | | - // Stop listening |
63 | | - popSensor.StopListening(); |
64 | | - |
65 | | - // Print the gathered data |
66 | | - POPSensorData data(popSensor.Gather()); |
67 | | - data.Print(); |
68 | | - |
69 | | - // Clear data |
70 | | - popSensor.Clear(); |
71 | | - |
72 | | -As shown here the POPSensor object can be used in a very simple and efficient manner. For the programmer this class can be used transparently. |
73 | | - |
74 | | -To compile and run this example use: |
75 | | - |
76 | | - cd pop-win |
77 | | - make |
78 | | - popcrun objects.map ./main_example resources.json |
79 | | - |
80 | | - |
81 | | -### main.cpp |
82 | | -This file contains a more complete use of the POPWin objects. It also instantiates a POPSensor objects and lets the user send commands via the keyboard. This example can be used to test the system. |
83 | | - |
84 | | -To compile and run this example use: |
85 | | - |
86 | | - cd pop-win |
87 | | - make |
88 | | - popcrun objects.map ./main resources.json |
89 | | - |
90 | | - |
91 | | -Specifications |
92 | | --------------- |
93 | | -### Resource description |
94 | | -The resources (or sensors) that the programmer wants to access are specified in the **resource.json** file. It can contain the following fields: |
95 | | -- **gateway**: specifies how to access the gateway sensor |
96 | | - - **url**: the machine on which the gateway sensor is connected |
97 | | - - **connection**: the connection between the machine and the gateway sensor (for now only usb is supported) |
98 | | -- **nodes**: specifies the types of measurement |
99 | | - - **measurement type**: temperature, humidity, light, ... as specified in [gatewayMote/popwin_messages.h] |
100 | | - - **direction**: "IN" for sensor or "OUT" for actuators |
101 | | - |
102 | | - |
103 | | - { |
104 | | - "gateways":[ |
105 | | - { |
106 | | - "url": "localhost", |
107 | | - "connection": "usb" |
108 | | - } |
109 | | - ], |
110 | | - "wsns":{ |
111 | | - "nodes":[ |
112 | | - { |
113 | | - "measurementType": "temperature", |
114 | | - "direction": "IN" |
115 | | - }, |
116 | | - { |
117 | | - "measurementType": "humidity", |
118 | | - "direction": "IN" |
119 | | - }, |
120 | | - { |
121 | | - "measurementType": "light", |
122 | | - "direction": "IN" |
123 | | - } |
124 | | - ] |
125 | | - } |
126 | | - } |
127 | | - |
128 | | -Examples of resource files can be found [resources.json](here) and [multi_gw.json](here). |
129 | | - |
130 | | - |
131 | | -### Messaging |
132 | | -In the low-level part of the system (that uses the publish/subscribe messaging model) the following types of models are implemented: notification, publication and subscription. Please note that unsubscriptions are not implemented yet but their structure is identical to subscription messages. |
133 | | - |
134 | | -The messages can contain the following fields: |
135 | | -- **MeasurementType**: An enum that specifies the type of measurement: temperature, vibration, humidity, ... |
136 | | -- **MeasurementUnit**: An enum that specifies the measurement unit: Celsius, seconds, meters, ... |
137 | | -- **PublicationType**: An enum that specifies the type of publication: e.g. led |
138 | | -- **ID** : The id of the sender |
139 | | -- **DataType** : An enum that specifies the type of the data: double, int or string |
140 | | -- **data** : A buffer of character (of size BUFFERDATASIZE=64) that contains the data. For compatibility between systems integers and floats are printed to this buffer and not stored as bit value. |
141 | | -- **DataSize** : The size of the above data in characters |
142 | | - |
143 | | -TODO: Add buffering functions (2 ways) + link to .h |
144 | | - |
145 | | -#### Notification message |
146 | | - |
147 | | - struct NotifyMessage |
148 | | - { |
149 | | - enum MeasurementType measurementType; |
150 | | - enum DataType dataType; |
151 | | - unsigned short id; |
152 | | - enum MeasurementUnit unit; |
153 | | - size_t dataSize; |
154 | | - char data[BUFFERDATASIZE]; |
155 | | - }; |
156 | | - |
157 | | -#### Publication message |
158 | | - |
159 | | - struct PublishMessage |
160 | | - { |
161 | | - enum PublicationType publicationType; |
162 | | - enum DataType dataType; |
163 | | - unsigned short id; // not mandatory, for convenience |
164 | | - size_t dataSize; |
165 | | - char data[BUFFERDATASIZE]; |
166 | | - }; |
167 | | - |
| 48 | +A more complete scheme of the network can be found [here](POPWINarchi.pdf) ! |
168 | 49 |
|
169 | | -#### Subscription message |
170 | 50 |
|
171 | | - struct SubscribeMessage |
172 | | - { |
173 | | - unsigned short id; // Id is not mandatory. Only for convenience |
174 | | - enum MeasurementType measurementType; |
175 | | - enum DataType dataType; |
176 | | - }; |
177 | 51 |
|
178 | 52 |
|
0 commit comments