Message.h
Go to the documentation of this file.
00001 /*
00002 * Message.h is a header file defining message structure for the diagnosis board protocole.
00003 *
00004 * Copyright (c).2012. OWNER: Institute for Software Technology, TU Graz Austria.
00005 * Authors: Safdar Zaman, Gerald Steinbauer. (szaman@ist.tugraz.at, steinbauer@ist.tugraz.at)
00006 * All rights reserved.
00007 *    This program is free software: you can redistribute it and/or modify
00008 *    it under the terms of the GNU General Public License as published by
00009 *    the Free Software Foundation, either version 3 of the License, or
00010 *    (at your option) any later version.
00011 *
00012 *    This program is distributed in the hope that it will be useful,
00013 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 *    GNU General Public License for more details.
00016 *
00017 *    You should have received a copy of the GNU General Public License
00018 *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
00019 */
00020 
00021 #ifndef _MESSAGE_
00022 #define _MESSAGE_
00023 #include <stdlib.h>
00024 #include <stdio.h>
00025 #include <vector>
00026 #include "Measurment.h"
00027 #include "Specification.h"
00028 
00029 using namespace std;
00030 using std::vector;
00031 
00032 class Message
00033 {
00034 public:
00035     Message();
00036     Message(char dlm,char cmd,ushort len);
00037    ~Message();
00038     virtual unsigned char* getBuffer(int & buf_len){};
00039     virtual unsigned char* parseBuffer(){};
00040     virtual void parseBuffer(unsigned char *buf){};
00041    
00042 protected:
00043    char delim;
00044    char command;
00045    ushort length;
00046    unsigned char *body;
00047    
00048 };
00049 
00050 class MessageSpefications: public Message
00051 {
00052 public:
00053     MessageSpefications();
00054     MessageSpefications(char dlm,char cmd,ushort len);
00055     ~MessageSpefications();
00056     void parseBuffer(unsigned char *buf);
00057    
00058 private:
00059    vector<Specification> spf_vector;
00060    char channels;
00061    
00062 };
00063 
00064 class MessageBroadCasting: public Message
00065 {
00066 public:
00067     MessageBroadCasting();
00068     MessageBroadCasting(unsigned char frq);
00069     ~MessageBroadCasting();
00070     unsigned char* getBuffer(int & buf_len);
00071 
00072 private:
00073    char frequency;
00074 
00075 };
00076 
00077 class MessageMeasurments: public Message
00078 {
00079 public:
00080     MessageMeasurments();
00081     MessageMeasurments(char dlm,char cmd,ushort len);
00082    ~MessageMeasurments();
00083    void parseBuffer(unsigned char *buf);
00084 private:
00085    vector<Measurment> msr_vector;
00086    char channels;
00087 };
00088 
00089 class MessageRequest: public Message
00090 {
00091 public:
00092     MessageRequest();
00093    ~MessageRequest();
00094    unsigned char* getBuffer(int & buf_len);
00095     
00096 };
00097 
00098 class MessageChannelOnOff: public Message
00099 {
00100 public:
00101     MessageChannelOnOff();
00102     MessageChannelOnOff(char chnl,char st);
00103    ~MessageChannelOnOff();
00104     unsigned char* getBuffer(int & buf_len);
00105 private:
00106   char channel;
00107   char state;
00108 };
00109 
00110 class MessageAcknowledgment: public Message
00111 {
00112 public:
00113     MessageAcknowledgment();
00114     MessageAcknowledgment(char dlm,char cmd,ushort len);
00115    ~MessageAcknowledgment();
00116    void parseBuffer(unsigned char *p);
00117 private:
00118    char ecode;
00119  
00120 };
00121 
00122 #endif //_MESSAGE_


tug_ist_diagnosis_board
Author(s): Safdar Zaman, Gerald Steinbauer
autogenerated on Mon Jan 6 2014 11:51:23