nidas v1.2.3
BluetoothRFCommSocketIODevice.h
Go to the documentation of this file.
1// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
2// vim: set shiftwidth=4 softtabstop=4 expandtab:
3/*
4 ********************************************************************
5 ** NIDAS: NCAR In-situ Data Acquistion Software
6 **
7 ** 2010, Copyright University Corporation for Atmospheric Research
8 **
9 ** This program is free software; you can redistribute it and/or modify
10 ** it under the terms of the GNU General Public License as published by
11 ** the Free Software Foundation; either version 2 of the License, or
12 ** (at your option) any later version.
13 **
14 ** This program is distributed in the hope that it will be useful,
15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ** GNU General Public License for more details.
18 **
19 ** The LICENSE.txt file accompanying this software contains
20 ** a copy of the GNU General Public License. If it is not found,
21 ** write to the Free Software Foundation, Inc.,
22 ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 **
24 ********************************************************************
25*/
26
27#include <nidas/Config.h>
28
29#ifdef HAVE_BLUETOOTH_RFCOMM_H
30
31#ifndef NIDAS_CORE_BLUETOOTHRFCOMMSOCKETIODEVICE_H
32#define NIDAS_CORE_BLUETOOTHRFCOMMSOCKETIODEVICE_H
33
35#include "SocketIODevice.h"
36
37namespace nidas { namespace core {
38
42class BluetoothRFCommSocketIODevice : public SocketIODevice {
43
44public:
45
51
53
60 void open(int flags);
61
65 int getReadFd() const
66 {
67 if (_socket) return _socket->getFd();
68 return -1;
69 }
70
74 int getWriteFd() const {
75 if (_socket) return _socket->getFd();
76 return -1;
77 }
78
84 size_t read(void *buf, size_t len)
85 {
86 return _socket->recv(buf,len);
87 }
88
94 size_t read(void *buf, size_t len, int msecTimeout);
95
101 size_t write(const void *buf, size_t len)
102 {
103 return _socket->send(buf,len);
104 }
105
111 void close();
112
113private:
114
115 nidas::util::BluetoothRFCommSocket* _socket;
116
118 BluetoothRFCommSocketIODevice(const BluetoothRFCommSocketIODevice &);
119
121 BluetoothRFCommSocketIODevice& operator=(const BluetoothRFCommSocketIODevice &);
122
123};
124
125}} // namespace nidas namespace core
126
127#endif
128#endif
Sample * getSample(sampleType type, unsigned int len)
A convienence method for getting a sample of an enumerated type from a pool.
Definition Sample.cc:70
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31
int len
Definition sing.cc:948