blob: 5b0fcc65cf661398b34c3e1c35683d87d2ce8cf9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
/* -*- mode: C++; tab-width: 4 -*- */
/* ===================================================================== *\
Copyright (c) 2000-2001 Palm, Inc. or its subsidiaries.
All rights reserved.
This file is part of the Palm OS Emulator.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
\* ===================================================================== */
#ifndef EmTransportSerialUnix_h
#define EmTransportSerialUnix_h
#include "EmTransportSerial.h"
#include "omnithread.h" // omni_mutex
#include <deque> // deque
class EmHostTransportSerial
{
public:
EmHostTransportSerial (void);
~EmHostTransportSerial (void);
ErrCode OpenCommPort (const EmTransportSerial::ConfigSerial&);
ErrCode CreateCommThreads (const EmTransportSerial::ConfigSerial&);
ErrCode DestroyCommThreads (void);
ErrCode CloseCommPort (void);
// Manage data coming in the host serial port.
void PutIncomingData (const void*, long&);
void GetIncomingData (void*, long&);
long IncomingDataSize (void);
// Manage data going out the host serial port.
void PutOutgoingData (const void*, long&);
void GetOutgoingData (void*, long&);
long OutgoingDataSize (void);
static void* CommRead (void*);
static void* CommWrite (void*);
int GetBaud (EmTransportSerial::Baud);
int GetDataBits (EmTransportSerial::DataBits);
public:
omni_thread* fReadThread;
omni_thread* fWriteThread;
int fCommHandle;
int fCommSignalPipeA;
int fCommSignalPipeB;
int fTimeToQuit;
omni_mutex fDataMutex;
omni_condition fDataCondition;
omni_mutex fReadMutex;
deque<char> fReadBuffer;
omni_mutex fWriteMutex;
deque<char> fWriteBuffer;
};
#endif /* EmTransportSerialUnix_h */
|