VSM C++ SDK
Vehicle Specific Modules SDK
peripheral_message.h
Go to the documentation of this file.
1 // Copyright (c) 2014, Smart Projects Holdings Ltd
2 // All rights reserved.
3 // See LICENSE file for license details.
4 
8 #ifndef _PERIPHERAL_MESSAGE_H_
9 #define _PERIPHERAL_MESSAGE_H_
10 
12 #include <set>
13 #include <ugcs/vsm/io_stream.h>
14 
15 
16 namespace ugcs {
17 namespace vsm {
18 namespace Peripheral_message {
19 
20 
22  enum class PERIPHERAL_TYPE {
23  PERIPHERAL_DEVICE_UNKNOWN = 0, // Unknown device
24  PERIPHERAL_DEVICE_ADSB = 1 // ADS-B device
25  };
26 
28  enum class PERIPHERAL_STATE {
29  PERIPHERAL_STATE_DISCONNECTED = 0, // Device disconnected
30  PERIPHERAL_STATE_HEARTBEAT_OK = 1, // Device reports heartbeat ok
31  PERIPHERAL_STATE_HEARTBEAT_NOK = 2 // Device reports heartbeat missing
32  };
33 
38  class Peripheral_register : public std::enable_shared_from_this<Peripheral_register> {
40 
41  public:
43  Peripheral_register(uint16_t, PERIPHERAL_TYPE, std::string, std::string);
44 
46  uint16_t
47  Get_id() { return device_id; }
48 
51  Get_dev_type() { return device_type; }
52 
54  std::string
55  Get_name() { return device_name; }
56 
58  std::string
59  Get_port() { return port_name; }
60 
61  private:
63  uint16_t device_id;
64 
66  PERIPHERAL_TYPE device_type;
67 
69  std::string device_name;
70 
72  std::string port_name;
73  };
74 
75  class Peripheral_update : public std::enable_shared_from_this<Peripheral_update> {
77 
78 
79  public:
82 
84  uint16_t
85  Get_id() { return device_id; }
86 
89  Get_state() { return device_state; }
90 
91  private:
93  uint16_t device_id;
94 
96  PERIPHERAL_STATE device_state;
97  };
98 
99 } /* namespace Peripheral_message */
100 } /* namespace vsm */
101 } /* namespace ugcs */
102 
103 #endif /* _PERIPHERAL_MESSAGE_H_ */
UGCS root namespace.
Definition: android-linux/ugcs/vsm/platform_sockets.h:27
uint16_t Get_id()
Returns device ID.
Definition: peripheral_message.h:85
Abstract stream for I/O operations.
std::string Get_name()
Returns device name.
Definition: peripheral_message.h:55
PERIPHERAL_STATE
Enum for device states.
Definition: peripheral_message.h:28
Reference guard class definition.
std::string Get_port()
Returns device port.
Definition: peripheral_message.h:59
PERIPHERAL_TYPE Get_dev_type()
Returns device type.
Definition: peripheral_message.h:51
Class that should contain report information.
Definition: peripheral_message.h:38
uint16_t Get_id()
Returns device ID.
Definition: peripheral_message.h:47
PERIPHERAL_TYPE
Enum for device types.
Definition: peripheral_message.h:22
Definition: peripheral_message.h:75
PERIPHERAL_STATE Get_state()
Returns device state.
Definition: peripheral_message.h:89
#define DEFINE_COMMON_CLASS(__class_name,...)
Use this macro to define some common attributes for a class.
Definition: utils.h:25