Sensor Scol plugin
Multi platform sensors for handled devices
SWSensor.h
1#ifndef _WSENSOR_H_
2#define _WSENSOR_H_
3
4# ifdef _WIN32
5
6#include <set>
7#include "Sensorsapi.h"
8#include "SSensor.h"
9
10
11/* CLASS NAME: Sensor
12 * \brief Represents a sensor.
13
14 * Used to store sensor datas received by events. The purpose if to get datas synchronously (by a simple 'get' method)
15 */
16class SWSensor : public SSensor
17{
18 /* * * * * * * * * * * * * FRIENDS * * * * * * * * * * * * */
19
20 /* * * * * * * * * * * * * ATTRIBUTES * * * * * * * * * * * * */
21 public:
22 protected:
23 SSensorType mType;
24 ISensor* mISensor;
25 bool mEnabled;
26 private:
27
28 /* * * * * * * * * * * * * CONSTRUCTORS * * * * * * * * * * * * */
29 public:
30 SWSensor();
31 SWSensor(SSensorType type);
32 ~SWSensor();
33 protected:
34 private:
35
36 /* * * * * * * * * * * * * METHODS * * * * * * * * * * * * */
37 public:
38 virtual SSensorData GetData();
39 void SetISensor(ISensor* isensor);
40 ISensor* GetISensor();
41 protected:
42 private:
43};
44
45/* CLASS NAME: SensorManager
46 * \brief Manager sensors.
47
48 * Used to list sensor objects. It is possible to manage them through this class (enable/disable, ...).
49 */
50class SWSensorManager : public SSensorManager
51{
52 /* * * * * * * * * * * * * FRIENDS * * * * * * * * * * * * */
53
54 /* * * * * * * * * * * * * ATTRIBUTES * * * * * * * * * * * * */
55 public:
56 protected:
57 std::set<SSensor*> mSensorList;
58 ISensorManager* mISensorManager;
59 private:
60 static SSensorManager* mSingletonInstance;
61
62 /* * * * * * * * * * * * * CONSTRUCTORS * * * * * * * * * * * * */
63 public:
64 SWSensorManager();
65 ~SWSensorManager();
66 protected:
67 private:
68
69 /* * * * * * * * * * * * * METHODS * * * * * * * * * * * * */
70 public:
71 virtual int SetSensorEnable(SSensorType sensorType, bool state);
72 virtual void Vibrate(long millis);
73 virtual void StartVibration();
74 virtual void StopVibration();
75 virtual void VibratePattern(std::vector<int> pattern, bool loop);
76
77 virtual void StartLocationService();
78 virtual void StopLocationService();
79 virtual bool GetLocation(float &longitude, float &latitude, float &altitude);
80
81 protected:
82 private:
83 int SetSensorDelay(SSensor* sensor, unsigned long newDelay);
84};
85
86#endif
87#endif