SoDaRadio-5.0.3-master:8901fb5
src
SerialDev.hxx
Go to the documentation of this file.
1
/*
2
Copyright (c) 2015, Matthew H. Reilly (kb1vc)
3
All rights reserved.
4
5
Redistribution and use in source and binary forms, with or without
6
modification, are permitted provided that the following conditions are
7
met:
8
9
Redistributions of source code must retain the above copyright
10
notice, this list of conditions and the following disclaimer.
11
Redistributions in binary form must reproduce the above copyright
12
notice, this list of conditions and the following disclaimer in
13
the documentation and/or other materials provided with the
14
distribution.
15
16
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
*/
28
29
#ifndef GenericSerial_HDR
30
#define GenericSerial_HDR
31
32
#include <string>
33
#include <list>
34
35
#include <boost/format.hpp>
36
#include <iostream>
37
namespace
SoDa
{
38
39
class
SerialDev
{
40
public
:
41
SerialDev
(
const
std::string & devname,
unsigned
int
speed = 9600,
42
bool
par_ena =
false
,
bool
par_even =
true
);
43
44
bool
putString
(
const
std::string & str);
45
46
bool
getString
(std::string & str,
unsigned
int
maxlen);
47
48
bool
palindromeCommand
(std::string & str);
49
bool
flushInput
();
50
51
bool
flushOutput
();
52
53
private
:
54
55
bool
serial_port_open
;
// true if we were able to create a device...
56
57
int
port
;
58
59
int
getSpeed
(
int
spd);
60
};
61
}
62
#endif
SoDa::SerialDev
Definition:
SerialDev.hxx:39
SoDa::SerialDev::getString
bool getString(std::string &str, unsigned int maxlen)
Definition:
SerialDev.cxx:117
SoDa::SerialDev::port
int port
Definition:
SerialDev.hxx:57
SoDa::SerialDev::SerialDev
SerialDev(const std::string &devname, unsigned int speed=9600, bool par_ena=false, bool par_even=true)
Definition:
SerialDev.cxx:49
SoDa::SerialDev::flushInput
bool flushInput()
Definition:
SerialDev.cxx:167
SoDa
Definition:
AudioALSA.cxx:42
SoDa::SerialDev::serial_port_open
bool serial_port_open
Definition:
SerialDev.hxx:55
SoDa::SerialDev::flushOutput
bool flushOutput()
Definition:
SerialDev.cxx:172
SoDa::SerialDev::getSpeed
int getSpeed(int spd)
Definition:
SerialDev.cxx:152
SoDa::SerialDev::palindromeCommand
bool palindromeCommand(std::string &str)
Definition:
SerialDev.cxx:178
SoDa::SerialDev::putString
bool putString(const std::string &str)
Definition:
SerialDev.cxx:108
Generated on Sun Sep 24 2017 12:16:38 for SoDaRadio-5.0.3-master:8901fb5 by
1.8.13