xref: /haiku/src/apps/serialconnect/SerialApp.h (revision 220d04022750f40f8bac8f01fa551211e28d04f2)
1 /*
2  * Copyright 2012, Adrien Destugues, pulkomandy@gmail.com
3  * Distributed under the terms of the MIT licence.
4  */
5 
6 
7 #ifndef _SERIALAPP_H_
8 #define _SERIALAPP_H_
9 
10 
11 #include <Application.h>
12 #include <SerialPort.h>
13 #include <String.h>
14 
15 
16 class BFile;
17 class SerialWindow;
18 
19 
20 class SerialApp: public BApplication
21 {
22 	public:
23 		SerialApp();
24 		~SerialApp();
25 		void ReadyToRun();
26 		void MessageReceived(BMessage* message);
27 		bool QuitRequested();
28 
29 		const BString& GetPort();
30 
31 	private:
32 		void LoadSettings();
33 		void SaveSettings();
34 
35 	private:
36 		BSerialPort fSerialPort;
37 		sem_id fSerialLock;
38 		SerialWindow* fWindow;
39 		BFile* fLogFile;
40 		BString fPortPath;
41 
42 		static status_t PollSerial(void*);
43 
44 		static const char* kApplicationSignature;
45 };
46 
47 
48 enum messageConstants {
49 	kMsgDataRead  = 'dare',
50 	kMsgDataWrite = 'dawr',
51 	kMsgLogfile   = 'logf',
52 	kMsgOpenPort  = 'open',
53 	kMsgSettings  = 'stty',
54 };
55 
56 #endif
57