IQRF Gateway Daemon
Public Member Functions | List of all members
JsonSerializer Class Reference

Object factory to create DpaTask objects from incoming messages. More...

#include <JsonSerializer.h>

Inheritance diagram for JsonSerializer:
ObjectFactory< DpaTask, rapidjson::Value > ISerializer

Public Member Functions

 JsonSerializer ()
 
 JsonSerializer (const std::string &name)
 
virtual ~JsonSerializer ()
 
const std::string & getName () const override
 returns instance name More...
 
std::string parseCategory (const std::string &request) override
 ISerializer overriden methods. More...
 
std::unique_ptr< DpaTask > parseRequest (const std::string &request) override
 Parse DPA request. More...
 
std::string parseConfig (const std::string &request) override
 Parse confiquration request. More...
 
std::string encodeConfig (const std::string &request, const std::string &response) override
 Encode confiquration response. More...
 
std::string getLastError () const override
 Get last error string. More...
 
std::string encodeAsyncAsDpaRaw (const DpaMessage &dpaMessage) const override
 Encode Asynchronous DPA message. More...
 
- Public Member Functions inherited from ObjectFactory< DpaTask, rapidjson::Value >
std::unique_ptr< DpaTask > createObject (const std::string &id, rapidjson::Value &representation)
 Create object based on data representation. More...
 
void registerClass (const std::string &id)
 Template function to register object creator function. More...
 
bool hasClass (const std::string &id)
 Check if a creator object is registered. More...
 
- Public Member Functions inherited from ISerializer
virtual ~ISerializer ()
 

Detailed Description

Object factory to create DpaTask objects from incoming messages.

Uses inherited ObjectFactory features to create DpaTask object from incoming JSON messages.

Constructor & Destructor Documentation

◆ JsonSerializer() [1/2]

JsonSerializer::JsonSerializer ( )

◆ JsonSerializer() [2/2]

JsonSerializer::JsonSerializer ( const std::string &  name)

parametric constructor

Parameters
[in]nameinstance name

◆ ~JsonSerializer()

virtual JsonSerializer::~JsonSerializer ( )
inlinevirtual

Member Function Documentation

◆ encodeAsyncAsDpaRaw()

std::string JsonSerializer::encodeAsyncAsDpaRaw ( const DpaMessage &  dpaMessage) const
overridevirtual

Encode Asynchronous DPA message.

Parameters
[in]dpaMessagemessage to be encoded
Returns
serialized message

Passed asynchronous DPA message is serialized in an appropriate form.

Implements ISerializer.

◆ encodeConfig()

std::string JsonSerializer::encodeConfig ( const std::string &  request,
const std::string &  response 
)
overridevirtual

Encode confiquration response.

Parameters
[in]requestoriginal configuration request
[in]responsestring with response phrase
Returns
string with configuration response

Encode configuration response based on original configuration request and passed response phrase.

Implements ISerializer.

◆ getLastError()

std::string JsonSerializer::getLastError ( ) const
overridevirtual

Get last error string.

Returns
error string

Serializer sets last error string as the result of last serialization.

Implements ISerializer.

◆ getName()

const std::string& JsonSerializer::getName ( ) const
inlineoverridevirtual

returns instance name

Implements ISerializer.

◆ parseCategory()

std::string JsonSerializer::parseCategory ( const std::string &  request)
overridevirtual

ISerializer overriden methods.

Implements ISerializer.

◆ parseConfig()

std::string JsonSerializer::parseConfig ( const std::string &  request)
overridevirtual

Parse confiquration request.

Parameters
[in]requestconfiguration request
Returns
string with configuration

It expects incoming configuration request (detected by parseCategory). It parses the request and return configuration string. The only switch mode forwarding | operational | service is supported now. Returned string may be empty in case of error.

Implements ISerializer.

◆ parseRequest()

std::unique_ptr< DpaTask > JsonSerializer::parseRequest ( const std::string &  request)
overridevirtual

Parse DPA request.

Parameters
[in]requestincoming DPA request
Returns
DPA task created from incomming request

It expects incoming DPA request (detected by parseCategory). It parses DPA request and create DpaTask. DpaTask may be empty in case of error.

Implements ISerializer.


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