Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

packet.h

Go to the documentation of this file.
00001 /*
00002  * MAX : packet.h, 16.08.2002 -sg
00003  * 
00004  * declaration for socket datagramm packets
00005  *
00006  * This file is part of Max data acquisition software
00007  * Copyright (C) 1997,98 Christian Rosen
00008  *
00009  * Max is free software; you can redistribute it and/or modify it
00010  * under the terms of the version 2 of GNU General Public License as
00011  * published by the Free Software Foundation.
00012  *
00013  * Max is distributed in the hope that it will be useful, but WITHOUT
00014  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00015  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00016  * for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * (see the file COPYING) in this directory; if not, write to the
00020  * Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00021  */
00022 
00023 /* chain _byte :
00024  * bit 0 : first packet of sequence
00025  * bit 1 : middle packet
00026  * bit 2 : last packet of sequence
00027  */
00028 
00029 #ifndef _PACKET_H_
00030 #define _PACKET_H_
00031 #include "definitions.h"
00032 #pragma pack(1)     /*byte alignment*/
00033 typedef struct {                       //starts with header
00034         unsigned char chain_byte;            //for this data set
00035         unsigned char type;                  //a = int,b=double,c = char;
00036         unsigned char device_index[sizeof(int)];
00037         unsigned char priority    [sizeof(int)];    //device it belongs to
00038         unsigned char var_index   [sizeof(int)];  //channel of this device
00039         unsigned char t_length    [sizeof(int)];    //length of total data sequence
00040         unsigned char data_length [sizeof(int)]; //length of this buffer
00041         unsigned char channel     [sizeof(int)];                
00042         unsigned char buffer      [DATA_PACKET_SIZE]; //measured data
00043 } dataPacket;
00044 #pragma pack()
00045 #define FULL_P_SIZE sizeof(dataPacket) //total size of packet data+header
00046 
00047 /*command packet :
00048  * contains commands for client GUI to control the polld :
00049  * for exact command description see definitions.h
00050  * channel numbers and priorities can not exceed 16bit (65536)
00051  */
00052 #pragma pack(1)                         //byte alignment
00053 typedef struct {
00054         unsigned char command;                //command string
00055         unsigned char name[MAX_NAME_LENGTH];  //buffer for device name
00056         unsigned char data[sizeof(int)];      //databyte        
00057         unsigned char data_high;              //high data byte
00058         unsigned char error_msg[ERR_MSG_LENGTH]; //user error message
00059 } command_packet;
00060 #pragma pack()
00061 
00062 #define CPACKETSIZE sizeof(command_packet)
00063 
00064 /* packet to transmit device data information
00065  * type :
00066  * 0 = dataset for device data
00067  * >0  = error message
00068  * var name contains user defined message
00069  * length is limited to 255 bytes
00070  */
00071 #pragma pack(1) /*byte alignment*/
00072 typedef struct {
00073         unsigned char length;
00074         unsigned char type;      // 'i'= integer, 'd' = double, 's'= string, 'c' = char
00075         unsigned char status;    // 'a' enabled, 'b' disabled
00076         unsigned char enabled;  //Enabled byte '/0' disabled  'a' enabled
00077         unsigned char device_name[MAX_DEVICE_NAME_LENGTH];
00078         unsigned char var_name   [MAX_NAME_LENGTH];
00079         unsigned char value      [MAX_VAR_LENGTH];
00080 } devDataPacket;
00081 #pragma pack()
00082 
00083 #define DPACKETSIZE sizeof(devDataPacket)
00084 
00085 /****************************************/
00086 /*some other structures used by several */
00087 /* classes .....                        */
00088 /****************************************/
00089 
00090 
00091 //structure to hold all plot Options
00092 //it is passed to the Plotwidget to initialize it
00093 //used in list.cpp and plot.cpp
00094 typedef struct {
00095         int pminx;
00096         int pminy;
00097         int pleftborder;
00098         int pupperborder;
00099         int pdefsizex;
00100         int pdefsizey;
00101         int xticks;
00102         int yticks;
00103         int ticksize;
00104         int tickpos;
00105         int tickposx;
00106         int as_interval;
00107         double yupper;
00108         double ylower;
00109         bool hgridlines;
00110         bool vgridlines;
00111         bool autoscale;
00112 } PlotSettings;
00113   
00114 #endif

Generated at Mon Sep 2 18:21:04 2002 for MAX by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001