?? phycom.h
字號:
#ifndef PHYCOM_H
#define PHYCOM_H
#if (ACTUAL_OS == OS_LINUX) || (ACTUAL_OS == OS_UCLINUX) || (ACTUAL_OS == OS_UNIX)
#include "esctype.h"
#include "const.h"
#include "phys.h"
//#include "esclist.h"
//for windows platform
//for linux
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<termios.h>
#include<errno.h>
//#include<iostream.h>
/////////////////////////////////////////////////////////////////////
struct PhyChnlConfig
{
EscInt speed;
EscInt databits;
EscInt stopbits;
EscInt parity;
EscInt timeout;
EscChar* dev;
};
class PhysicalCom:public PhysicalLayer
{
private:
EscInt fd;
EscBool initialized;
PhyChnlConfig* phyConfig;
private:
void setSpeed(EscInt fd, EscInt speed);
EscInt setParity(EscInt fd,EscInt databits,EscInt stopbits,EscInt parity, EscInt timeout);
void setRawIo(EscInt fd );
EscInt InitDev(EscInt fd, EscInt speed, EscInt databits, EscInt stopbits, EscInt parity, EscInt timeout);
public:
EscInt recv(EscChar *buf,EscInt length,EscInt maxTimeOut,EscBool* timeoutOccur);
EscBool send(EscChar *buf,EscInt length);
public:
PhysicalCom(PhyChnlConfig* pConfig,EscInt poolSize);
EscBool openChannel();
void closeChannel();
~PhysicalCom();
};
#endif
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -