📄 cmdbasedrfcommhandler.hh
字号:
/* -*- c++ -*- --------------------------------------------------------------- Copyright (C) 2005, SWECO, All Rights Reserved. Manager of the RFCOMM bindings - command line tool based implementation $Id$ Author: Zsolt Molnar (Zsolt.Molnar@ieee.org) ---------------------------------------------------------------------------*/#ifndef __CMDBASEDRFCOMMHANDLER_HH__#define __CMDBASEDRFCOMMHANDLER_HH__#include <map>#include "Cache.hh"#include "Lockable.hh"#include "base.hh"#include "IRFCommHandler.hh"// Path base for the rfcomm devices#define CBRF_RFCOMM_DEV "/dev/rfcomm"#define CBRF_MAX_DEV 255#ifdef _cplusplusextern "C" {#endifclass ConnectedDevice : public Device {public: ConnectedDevice(const Device& aDevice); ConnectedDevice(const ConnectedDevice& aDevice); ~ConnectedDevice(); void setConnected() {_isConnected = true;}; void setUnconnected() {_isConnected = false;}; bool isConnected() {return _isConnected;};//private: bool _isConnected;};class CmdBasedRFCommHandler : virtual public IRFCommHandler, protected Lockable {public: typedef pair<int, int> tDevLimit;public: explicit CmdBasedRFCommHandler(); virtual ~CmdBasedRFCommHandler(); virtual bool serial_connect(const Device& aDevice); virtual bool unconnect(const Device& aDevice); virtual int getPort(const Device& aDevice); virtual int getMaxSerialConnections(); bool unconnect_nolock(const Device& aDevice);protected: virtual void _construct();private: int _getDevNumber(const tDevLimit& aLimits); bool _connect(const Device& aDevice, const int aChannel, const tDevLimit& aLimits);private: typedef Cache<ConnectedDevice> _tConnDb; _tConnDb _connDb; typedef map<Device, int> _tRFCommBindings; _tRFCommBindings _RFCommBindings; static const int _SERIAL_CHANNEL = 2; static const tDevLimit _serialLimits;#ifdef __TEST__public: bool test();#endif // #ifdef __TEST__};#ifdef _cplusplus}#endif#endif /* #ifndef __CMDBASEDRFCOMMHANDLER_HH__ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -