lifomcom.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef _MCOMDEVICE_HH_
00028 #define _MCOMDEVICE_HH_
00029
00030 #include <libplayercore/playercore.h>
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049 class LifoMCom : public Driver
00050 {
00051 private:
00052
00053 class Buffer {
00054 private:
00055 player_mcom_data_t dat[MCOM_N_BUFS];
00056 int top;
00057 int capacity;
00058 public:
00059 int type;
00060 char channel[MCOM_CHANNEL_LEN];
00061 Buffer();
00062 ~Buffer();
00063 void Push(player_mcom_data_t newdat);
00064 player_mcom_data_t Pop();
00065 player_mcom_data_t Read();
00066 void Clear();
00067 void print();
00068 void SetCapacity(int cap);
00069 int GetCapacity() { return capacity; }
00070 };
00071
00072 struct Link{
00073 Buffer buf;
00074 Link* next;
00075 };
00076
00077 class LinkList {
00078 private:
00079 Link * top;
00080 public:
00081 LinkList();
00082 ~LinkList();
00083 void Push(player_mcom_data_t d,int type, char channel[MCOM_CHANNEL_LEN]);
00084 player_mcom_data_t Pop(int type, char channel[MCOM_CHANNEL_LEN]);
00085 player_mcom_data_t Read(int type,char channel[MCOM_CHANNEL_LEN]);
00086 void Clear(int type,char channel[MCOM_CHANNEL_LEN]);
00087 void SetCapacity(int type, char channel[MCOM_CHANNEL_LEN],
00088 unsigned char cap);
00089 Link * FindLink(int type, char channel[MCOM_CHANNEL_LEN]);
00090 };
00091
00092 LinkList Data;
00093
00094 public:
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104 int ProcessMessage(ClientData * client, player_msghdr * hdr, uint8_t * data, uint8_t * resp_data, size_t * resp_len);
00105
00106
00107 LifoMCom(ConfigFile* cf, int section);
00108
00109 virtual int Setup() {
00110 printf("startup...\n");
00111 return 0;
00112 }
00113
00114 virtual int Shutdown() {
00115 printf("shutdown ...\n");
00116 return 0;
00117 }
00118 };
00119
00120
00121
00122
00123 Driver* LifoMCom_Init(char* interface, ConfigFile* cf, int section);
00124
00125
00126 void LifoMCom_Register(DriverTable* table);
00127
00128
00129
00130 #endif //ifdef _MCOMDEVICE_HH_
00131
Last updated 12 September 2005 21:38:45
|