VSM C++ SDK
Vehicle Specific Modules SDK
peripheral_device.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_DEVICE_H_
9 #define _PERIPHERAL_DEVICE_H_
10 
13 #include <set>
14 #include <ugcs/vsm/io_stream.h>
15 
16 
17 namespace ugcs {
18 namespace vsm {
19 
24 
25 public:
26 
29 
33  virtual uint16_t
34  Get_id() { return device_id; }
35 
40  Get_dev_type() { return device_type; }
41 
45  virtual std::string
47 
51  virtual std::string
52  Get_port_name() { return port_name; }
53 
54 protected:
55 
57  uint16_t device_id;
58 
61 
63  std::string friendly_name;
64 
66  std::string port_name;
67 
69  uint16_t
70  Get_new_id();
71 
73  static uint16_t
75 
77  void
78  Remove_id();
79 
80 private:
82  static std::set<uint8_t> used_id_list;
83 };
84 
85 } /* namespace vsm */
86 } /* namespace ugcs */
87 
88 #endif /* _PERIPHERAL_DEVICE_H_ */
UGCS root namespace.
Definition: android-linux/ugcs/vsm/platform_sockets.h:27
uint16_t Get_new_id()
Returns next free ID.
virtual Peripheral_message::PERIPHERAL_TYPE Get_dev_type()
Returns device type.
Definition: peripheral_device.h:40
std::string port_name
Port information for device identification.
Definition: peripheral_device.h:66
Abstract stream for I/O operations.
virtual std::string Get_friendly_name()
Returns a friendly device name.
Definition: peripheral_device.h:46
Reference guard class definition.
void Remove_id()
Releases ID to be used by other devices.
uint16_t device_id
Device identification number.
Definition: peripheral_device.h:57
virtual std::string Get_port_name()
Returns a port name.
Definition: peripheral_device.h:52
PERIPHERAL_TYPE
Enum for device types.
Definition: peripheral_message.h:22
virtual uint16_t Get_id()
Returns device id.
Definition: peripheral_device.h:34
Peripheral_message::PERIPHERAL_TYPE device_type
Device type.
Definition: peripheral_device.h:60
std::string friendly_name
Name information for device identification.
Definition: peripheral_device.h:63
Peripheral_device(Peripheral_message::PERIPHERAL_TYPE)
Default constructor.
Base interface for a peripheral device.
Definition: peripheral_device.h:23
static uint16_t Get_next_free_id()
Returns next free ID.