added missign file and converted BW control items

This commit is contained in:
csoler 2017-04-11 21:37:35 +02:00
parent 731e20d0a3
commit 80e8769ed7
3 changed files with 284 additions and 48 deletions

View file

@ -34,9 +34,17 @@
/*************************************************************************/
RsBwCtrlAllowedItem::~RsBwCtrlAllowedItem()
RsItem *RsBwCtrlSerialiser::create_item(uint16_t service, uint8_t item_sub_id)
{
return;
if(service != RS_SERVICE_TYPE_BWCTRL)
return NULL ;
switch(item_sub_id)
{
case RS_PKT_SUBTYPE_BWCTRL_ALLOWED_ITEM: return new RsBwCtrlAllowedItem();
default:
return NULL;
}
}
void RsBwCtrlAllowedItem::clear()
@ -44,27 +52,12 @@ void RsBwCtrlAllowedItem::clear()
allowedBw = 0;
}
std::ostream &RsBwCtrlAllowedItem::print(std::ostream &out, uint16_t indent)
void RsBwCtrlAllowedItem::serial_process(SerializeJob j,SerializeContext& ctx)
{
printRsItemBase(out, "RsBwCtrlAllowedItem", indent);
uint16_t int_Indent = indent + 2;
printIndent(out, int_Indent);
out << "AllowedBw: " << allowedBw;
out << std::endl;
printRsItemEnd(out, "RsBwCtrlAllowedItem", indent);
return out;
}
uint32_t RsBwCtrlSerialiser::sizeAllowed(RsBwCtrlAllowedItem * /*item*/)
{
uint32_t s = 8; /* header */
s += GetTlvUInt32Size();
return s;
RsTypeSerializer::serial_process<uint32_t>(j,ctx,TLV_TYPE_UINT32_BW,allowedBw,"allowedBw") ;
}
#ifdef TO_REMOVE
/* serialise the data to the buffer */
bool RsBwCtrlSerialiser::serialiseAllowed(RsBwCtrlAllowedItem *item, void *data, uint32_t *pktsize)
{
@ -200,6 +193,7 @@ RsItem *RsBwCtrlSerialiser::deserialise(void *data, uint32_t *pktsize)
}
/*************************************************************************/
#endif

View file

@ -32,50 +32,38 @@
#include "serialiser/rsserial.h"
#include "serialiser/rstlvbase.h"
#include "serialization/rsserializer.h"
#include "serialization/rstypeserializer.h"
#define RS_PKT_SUBTYPE_BWCTRL_ALLOWED_ITEM 0x01
/**************************************************************************/
class RsBwCtrlAllowedItem: public RsItem
{
public:
RsBwCtrlAllowedItem()
:RsItem(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_BWCTRL,
RS_PKT_SUBTYPE_BWCTRL_ALLOWED_ITEM)
{
public:
RsBwCtrlAllowedItem() :RsItem(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_BWCTRL, RS_PKT_SUBTYPE_BWCTRL_ALLOWED_ITEM)
{
setPriorityLevel(QOS_PRIORITY_RS_BWCTRL_ALLOWED_ITEM);
return;
return;
}
virtual ~RsBwCtrlAllowedItem();
virtual void clear();
std::ostream &print(std::ostream &out, uint16_t indent = 0);
virtual ~RsBwCtrlAllowedItem() {}
virtual void clear();
uint32_t allowedBw; // Units are bytes/sec => 4Gb/s;
void serial_process(SerializeJob j,SerializeContext& ctx);
uint32_t allowedBw; // Units are bytes/sec => 4Gb/s;
};
class RsBwCtrlSerialiser: public RsSerialType
class RsBwCtrlSerialiser: public RsSerializer
{
public:
RsBwCtrlSerialiser()
:RsSerialType(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_BWCTRL)
{ return; }
virtual ~RsBwCtrlSerialiser()
{ 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 sizeAllowed(RsBwCtrlAllowedItem *);
virtual bool serialiseAllowed (RsBwCtrlAllowedItem *item, void *data, uint32_t *size);
virtual RsBwCtrlAllowedItem *deserialiseAllowed(void *data, uint32_t *size);
public:
RsBwCtrlSerialiser() :RsSerializer(RS_SERVICE_TYPE_BWCTRL) {}
virtual ~RsBwCtrlSerialiser() {}
RsItem *create_item(uint16_t /* service */, uint8_t /* item_sub_id */);
};
/**************************************************************************/