BaseCom.h
Go to the documentation of this file.
00001 #ifndef BASECOM_H
00002 #define BASECOM_H
00003 
00004 #include "Serializer.h"
00005 
00006 #define REQ_DATA 1
00007 #define REQ_RESULT 2
00008 #define REQ_NOMOREDATA 3
00009 
00010 struct BaseCom
00011 {
00012         unsigned char typeRequest;
00013         unsigned long dataLength;
00014         unsigned long id;
00015         unsigned packsize()
00016         {
00017                 unsigned int s = 0;
00018                 s += Serializer::packsize(typeRequest);
00019                 s += Serializer::packsize(dataLength);
00020                 s += Serializer::packsize(id);
00021                 return s;
00022         }
00023 
00024         unsigned char * pack(unsigned char * buffer)
00025         {
00026                 buffer = Serializer::pack(typeRequest,buffer);
00027                 buffer = Serializer::pack(dataLength,buffer);
00028                 buffer = Serializer::pack(id,buffer);
00029                 return buffer;
00030         }
00031 
00032         const unsigned char * unpack(const unsigned char * buffer)
00033         {
00034                 buffer = Serializer::unpack(&typeRequest,buffer);
00035                 buffer = Serializer::unpack(&dataLength,buffer);
00036                 buffer = Serializer::unpack(&id,buffer);
00037                 return buffer;
00038         }
00039 
00040 };
00041         
00042         
00043 #endif // BASECOM_H


canon_vbc50i
Author(s): Cedric Pradalier
autogenerated on Sun Oct 5 2014 23:47:45