|
rllib
1
|
00001 /*************************************************************************** 00002 rlppiclient.h - description 00003 ------------------- 00004 begin : Mon Jul 12 2004 00005 copyright : (C) 2004 by Rainer Lehrig 00006 email : lehrig@t-online.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This library is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as * 00013 * published by the Free Software Foundation * 00014 * * 00015 ***************************************************************************/ 00016 #ifndef _RL_PPI_CLIENT_H_ 00017 #define _RL_PPI_CLIENT_H_ 00018 00019 #include "rldefine.h" 00020 #include "rlmailbox.h" 00021 #include "rlsharedmemory.h" 00022 00028 class rlPPIClient : public rlMailbox, rlSharedMemory 00029 { 00030 public: 00031 enum PPI_area 00032 { 00033 daveSD = 0x3, 00034 daveInputs = 0x81, 00035 daveOutputs = 0x82, 00036 daveFlags = 0x83, 00037 daveDB = 0x84, //data blocks 00038 daveDI = 0x85, //not tested 00039 daveLocal = 0x86, //not tested 00040 daveV = 0x87, // don't know what it is 00041 daveCounter = 28, //not tested 00042 daveTimer = 29 //not tested 00043 }; 00044 rlPPIClient(const char *mbxname, const char *shmname, int shmsize, int have_to_swap=1); 00045 virtual ~rlPPIClient(); 00046 int write(int slave, int area, int dbnum, int start, int len, const unsigned char *data); 00047 int writeFloat(int slave, int area, int dbnum, int start, int len, const float *val); 00048 int writeDword(int slave, int area, int dbnum, int start, int len, const int *val); 00049 int writeShort(int slave, int area, int dbnum, int start, int len, const short *val); 00050 int writeUDword(int slave, int area, int dbnum, int start, int len, const unsigned int *val); 00051 int writeUShort(int slave, int area, int dbnum, int start, int len, const unsigned short *val); 00052 int read(int offset, int len); 00053 float Float(int index); 00054 int Dword(int index); 00055 int Short(int index); 00056 unsigned int UDword(int index); 00057 unsigned int UShort(int index); 00058 unsigned char buf[512]; // after calling read, the data is here 00059 private: 00060 int have_to_swap; 00061 }; 00062 00063 #endif 00064
1.7.5.1