SoDaRadio-12.2.0-cut_dependencies:6c82803
Loading...
Searching...
No Matches
SerialDev.hxx
Go to the documentation of this file.
1
/*
2
Copyright (c) 2015, 2025 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
#pragma once
30
31
#include <string>
32
#include <list>
33
34
#include <iostream>
35
namespace
SoDa
{
36
37
class
SerialDev
{
38
public
:
39
SerialDev
(
const
std::string & devname,
unsigned
int
speed = 9600,
40
bool
par_ena =
false
,
bool
par_even =
true
);
41
42
bool
putString
(
const
std::string & str);
43
44
bool
getString
(std::string & str,
unsigned
int
maxlen);
45
46
bool
palindromeCommand
(std::string & str);
47
bool
flushInput
();
48
49
bool
flushOutput
();
50
51
private
:
52
53
bool
serial_port_open
;
// true if we were able to create a device...
54
55
int
port
;
56
57
int
getSpeed
(
int
spd);
58
};
59
}
SoDa::SerialDev::palindromeCommand
bool palindromeCommand(std::string &str)
SoDa::SerialDev::flushOutput
bool flushOutput()
SoDa::SerialDev::getString
bool getString(std::string &str, unsigned int maxlen)
SoDa::SerialDev::serial_port_open
bool serial_port_open
Definition
SerialDev.hxx:53
SoDa::SerialDev::SerialDev
SerialDev(const std::string &devname, unsigned int speed=9600, bool par_ena=false, bool par_even=true)
SoDa::SerialDev::putString
bool putString(const std::string &str)
SoDa::SerialDev::flushInput
bool flushInput()
SoDa::SerialDev::getSpeed
int getSpeed(int spd)
SoDa::SerialDev::port
int port
Definition
SerialDev.hxx:55
SoDa
Definition
AudioIfc.hxx:34
src
SerialDev.hxx
Generated on
for SoDaRadio-12.2.0-cut_dependencies:6c82803 by
1.14.0