switched heartbeatitems to new serialization

This commit is contained in:
csoler 2017-04-27 21:10:22 +02:00
parent 349d14b354
commit 9adbab3281
4 changed files with 19 additions and 27 deletions

View File

@ -483,7 +483,7 @@ HEADERS += rsitems/rsitem.h \
rsitems/rsbanlistitems.h \
rsitems/rsbwctrlitems.h \
rsitems/rsdiscovery2items.h \
serialiser/rsheartbeatitems.h \
rsitems/rsheartbeatitems.h \
rsitems/rsrttitems.h \
serialiser/rsgxsrecognitems.h \
serialiser/rsgxsupdateitems.h \
@ -631,7 +631,6 @@ SOURCES += serialiser/rsbaseserial.cc \
rsitems/rsbanlistitems.cc \
rsitems/rsbwctrlitems.cc \
rsitems/rsdiscovery2items.cc \
serialiser/rsheartbeatitems.cc \
rsitems/rsrttitems.cc \
serialiser/rsgxsrecognitems.cc \
serialiser/rsgxsupdateitems.cc \

View File

@ -24,6 +24,7 @@
*
*/
#ifdef TO_REMOVE
#include "serialiser/rsbaseserial.h"
#include "rsitems/rsserviceids.h"
#include "serialiser/rsheartbeatitems.h"
@ -91,10 +92,6 @@ RsItem *RsHeartbeatSerialiser::deserialise(void *data, uint32_t *pktsize)
/*************************************************************************/
void RsHeartbeatItem::clear()
{
}
std::ostream &RsHeartbeatItem::print(std::ostream &out, uint16_t indent)
{
printRsItemBase(out, "RsHeartbeatItem", indent);
@ -204,3 +201,5 @@ RsHeartbeatItem *RsHeartbeatSerialiser::deserialiseHeartbeat(void *data, uint32_
/*************************************************************************/
#endif

View File

@ -28,9 +28,8 @@
#ifndef RS_HEARTBEAT_ITEMS_H
#define RS_HEARTBEAT_ITEMS_H
#include "serialiser/rsserial.h"
#include "rsitems/rsserviceids.h"
#include "rsitems/rsitem.h"
#include "rsitems/rsserviceids.h"
#include "rsitems/itempriorities.h"
const uint8_t RS_PKT_SUBTYPE_HEARTBEAT_PULSE = 0x01;
@ -43,30 +42,25 @@ public:
setPriorityLevel(QOS_PRIORITY_RS_HEARTBEAT_PULSE) ;
}
virtual ~RsHeartbeatItem() {}
virtual void serial_process(RsGenericSerializer::SerializeJob /* j */,RsGenericSerializer::SerializeContext& /* ctx */) {}
virtual void clear();
virtual std::ostream &print(std::ostream &out, uint16_t indent = 0);
virtual void clear(){}
};
class RsHeartbeatSerialiser: public RsSerialType
class RsHeartbeatSerialiser: public RsServiceSerializer
{
public:
RsHeartbeatSerialiser()
:RsSerialType(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_HEARTBEAT)
{ return; }
public:
RsHeartbeatSerialiser() :RsServiceSerializer(RS_SERVICE_TYPE_HEARTBEAT) {}
virtual ~RsHeartbeatSerialiser() { return; }
virtual uint32_t size(RsItem *);
virtual bool serialise (RsItem *item, void *data, uint32_t *size);
virtual RsItem * deserialise(void *data, uint32_t *size);
private:
virtual uint32_t sizeHeartbeat(RsHeartbeatItem *);
virtual bool serialiseHeartbeat(RsHeartbeatItem *item, void *data, uint32_t *size);
virtual RsHeartbeatItem *deserialiseHeartbeat(void *data, uint32_t *size);
virtual ~RsHeartbeatSerialiser() {}
virtual RsItem *create_item(uint16_t service,uint8_t item_subtype) const
{
if(service == RS_SERVICE_TYPE_HEARTBEAT && item_subtype == RS_PKT_SUBTYPE_HEARTBEAT_PULSE)
return new RsHeartbeatItem() ;
else
return NULL ;
}
};

View File

@ -26,7 +26,7 @@
#include <time.h>
#include "services/p3heartbeat.h"
#include "serialiser/rsheartbeatitems.h"
#include "rsitems/rsheartbeatitems.h"
#include "pqi/p3servicecontrol.h"
#include "pqi/pqipersongrp.h"