VSM C++ SDK
Vehicle Specific Modules SDK
ugcs::vsm::Device Class Referenceabstract
Inheritance diagram for ugcs::vsm::Device:
ugcs::vsm::Vehicle

Classes

class  Commit_scope
 

Public Types

typedef std::shared_ptr< DevicePtr
 Pointer type.
 
typedef std::weak_ptr< DeviceWeak_ptr
 Pointer type.
 
typedef Callback_proxy< void, std::vector< Property::Ptr > > Command_handler
 
typedef Callback_proxy< void, uint32_t, Proto_msg_ptr > Response_sender
 Completion handler type of the request. More...
 

Public Member Functions

 Device (bool create_thread=true)
 
void Enable ()
 Enable the instance. More...
 
void Disable ()
 Disable the instance. More...
 
bool Is_enabled ()
 Vehicle enable/disable status. More...
 
 Device (const Device &)=delete
 Disable copying. More...
 
void Process_requests ()
 Process requests assigned to vehicle in user thread, i.e. More...
 
void On_ucs_message (ugcs::vsm::proto::Vsm_message message, Response_sender completion_handler=Response_sender(), ugcs::vsm::Request_completion_context::Ptr completion_ctx=nullptr)
 
virtual void Fill_register_msg (ugcs::vsm::proto::Vsm_message &)=0
 
template<typename Type >
void Add_property (const std::string &name, Type value, Property::Value_type value_type)
 
template<typename Type >
void Add_property (const std::string &name, ugcs::vsm::proto::Field_semantic semantic, Type value)
 
uint32_t Get_session_id ()
 
Request_completion_context::Ptr Get_completion_ctx ()
 Get default completion context of the device. More...
 

Static Public Member Functions

template<typename... Args>
static Ptr Create (Args &&...args)
 Create an instance. More...
 

Protected Member Functions

void Register ()
 Register device instance to UCS processor. More...
 
void Unregister ()
 Unregister device instance from UCS processor. More...
 
Request_processor::Ptr Get_processing_ctx ()
 Get default processing context of the vehicle. More...
 
virtual void On_enable ()
 Device enable event handler. More...
 
virtual void On_disable ()
 Device disable event handler. More...
 
virtual void Handle_ucs_command (Ucs_request::Ptr request)
 Message from ucs arrived called by VSM SDK in vehicle context and should be overridden by user code.
 
void Send_ucs_message (Proto_msg_ptr msg)
 
Vsm_command::Ptr Get_command (int id)
 
Property::Ptr Add_telemetry (const std::string &name, ugcs::vsm::proto::Field_semantic sem=ugcs::vsm::proto::FIELD_SEMANTIC_DEFAULT, uint32_t timeout=0)
 
Property::Ptr Add_telemetry (const std::string &name, Property::Value_type type, uint32_t timeout=0)
 
void Remove_telemetry (Property::Ptr &t_field)
 
Vsm_command::Ptr Add_command (const std::string &name, bool as_command, bool in_mission)
 
void Add_status_message (const std::string &m)
 
void Commit_to_ucs ()
 

Protected Attributes

Request_completion_context::Ptr completion_ctx
 
Request_processor::Ptr processor
 
std::chrono::time_point< std::chrono::system_clock > begin_of_epoch
 
std::unordered_map< std::string, Property::Ptrproperties
 

Member Typedef Documentation

typedef Callback_proxy<void, uint32_t, Proto_msg_ptr> ugcs::vsm::Device::Response_sender

Completion handler type of the request.

Constructor & Destructor Documentation

ugcs::vsm::Device::Device ( const Device )
delete

Disable copying.

Member Function Documentation

template<typename... Args>
static Ptr ugcs::vsm::Device::Create ( Args &&...  args)
inlinestatic

Create an instance.

void ugcs::vsm::Device::Disable ( )

Disable the instance.

Should be called prior to intention to delete the instance.

void ugcs::vsm::Device::Enable ( )

Enable the instance.

Should be called right after vehicle instance creation.

Exceptions
Invalid_param_exceptionIf vehicle with the same model and and serial number is already registered.
Request_completion_context::Ptr ugcs::vsm::Device::Get_completion_ctx ( )

Get default completion context of the device.

Request_processor::Ptr ugcs::vsm::Device::Get_processing_ctx ( )
protected

Get default processing context of the vehicle.

bool ugcs::vsm::Device::Is_enabled ( )
inline

Vehicle enable/disable status.

virtual void ugcs::vsm::Device::On_disable ( )
inlineprotectedvirtual

Device disable event handler.

Can be overridden by derived class, if necessary.

Reimplemented in ugcs::vsm::Vehicle.

virtual void ugcs::vsm::Device::On_enable ( )
inlineprotectedvirtual

Device enable event handler.

Can be overridden by derived class, if necessary.

Reimplemented in ugcs::vsm::Vehicle.

void ugcs::vsm::Device::Process_requests ( )

Process requests assigned to vehicle in user thread, i.e.

the thread which calls this method. Supposed to be called only when vehicle is created without its own thread.

void ugcs::vsm::Device::Register ( )
protected

Register device instance to UCS processor.

After registration is done, UCS servers sees that new vehicle is available.

void ugcs::vsm::Device::Unregister ( )
protected

Unregister device instance from UCS processor.


The documentation for this class was generated from the following file: