8 #ifndef META_OCEAN_DEVICES_DEVICE_H
9 #define META_OCEAN_DEVICES_DEVICE_H
42 DEVICE_MEASUREMENT = (1u << 0u),
44 DEVICE_SENSOR = (1u << 1u) | DEVICE_MEASUREMENT,
46 DEVICE_TRACKER = (1u << 2u) | DEVICE_MEASUREMENT
100 inline int minorType()
const;
107 inline bool operator==(
const DeviceType& type)
const;
114 inline bool operator!=(
const DeviceType& type)
const;
121 inline bool operator>=(
const DeviceType& right)
const;
127 explicit inline operator bool()
const;
143 uint32_t minor_ = MINOR_INVALID;
159 inline const std::string& name()
const;
165 virtual const std::string&
library()
const = 0;
177 inline bool isValid()
const;
289 minor_(MINOR_INVALID)
303 minor_(
type.minor_ | minor)
320 return !(*
this ==
type);
325 static_assert(std::is_same<uint32_t, std::underlying_type<MinorType>::type>::value,
"Invalid data type!");
330 inline Device::DeviceType::operator bool()
const
Definition of a class holding the major and minor device type.
Definition: devices/Device.h:62
uint32_t minor_
Minor device type.
Definition: devices/Device.h:143
bool operator==(const DeviceType &type) const
Returns whether two device types are equal.
Definition: devices/Device.h:313
bool operator!=(const DeviceType &type) const
Returns whether two device types are not equal.
Definition: devices/Device.h:318
DeviceType()=default
Creates a new invalid device type.
int minorType() const
Returns the minor device type.
Definition: devices/Device.h:335
bool operator>=(const DeviceType &right) const
Returns whether the right device type is a subset of the left device type.
Definition: devices/Device.h:323
MajorType majorType() const
Returns the major device type.
Definition: devices/Device.h:308
static DeviceType translateDeviceType(const std::string &majorType, const std::string &minorType)
Translates the major and minor devices type from a readable string to a DeviceType object.
MajorType major_
Major device type.
Definition: devices/Device.h:140
This class is the base class for all devices of any type.
Definition: devices/Device.h:28
std::string deviceName
Name of this device.
Definition: devices/Device.h:275
Device(const std::string &name, const DeviceType type)
Creates a new device by is name.
virtual ~Device()
Destructs a device.
Lock deviceLock
Device lock.
Definition: devices/Device.h:284
virtual bool parameter(const std::string ¶meter, Value &value)
Returns an abstract parameter of this device.
bool isValid() const
Returns whether this device is valid.
Definition: devices/Device.h:350
virtual bool isStarted() const
Returns whether this device is active.
Device & operator=(const Device &device)=delete
Disabled copy operator.
virtual bool start()
Starts the device.
DeviceType type() const
Returns the major and minor type of this device.
Definition: devices/Device.h:345
bool deviceIsValid
Flag determining whether this device is valid.
Definition: devices/Device.h:281
MinorType
Base definition of a minor type.
Definition: devices/Device.h:53
@ MINOR_INVALID
Invalid minor type.
Definition: devices/Device.h:55
virtual bool setParameter(const std::string ¶meter, const Value &value)
Sets an abstract parameter of this device.
virtual bool pause()
Pauses the device.
virtual bool stop()
Stops the device.
static constexpr SubscriptionId invalidSubscriptionId()
Returns an invalid subscription id.
Definition: devices/Device.h:355
bool isExclusive() const
Returns whether this device can be use exclusively.
static MajorType translateMajorType(const std::string &majorType)
Translates the major devices type from a readable string to a value.
virtual const std::string & library() const =0
Returns the name of the owner library.
MajorType
Definition of all major device types.
Definition: devices/Device.h:38
@ DEVICE_INVALID
Invalid major type.
Definition: devices/Device.h:40
unsigned int SubscriptionId
Definition of a subscription id for event callbacks.
Definition: devices/Device.h:151
static std::string translateMajorType(const MajorType majorType)
Translates the major devices type to a readable string.
Device(const Device &device)=delete
Disabled copy constructor.
const std::string & name() const
Returns the name of this device.
Definition: devices/Device.h:340
DeviceType deviceType
Major and minor type of this device.
Definition: devices/Device.h:278
This class implements a factory able to create instances of devices.
Definition: devices/Factory.h:28
This class implements a recursive lock object.
Definition: Lock.h:31
This template class implements a object reference with an internal reference counter.
Definition: base/ObjectRef.h:58
This class implements a type independent value.
Definition: Value.h:23
The namespace covering the entire Ocean framework.
Definition: Accessor.h:15