xref: /haiku/src/apps/serialconnect/SerialApp.h (revision 44d19f4d32b8f7e9c01f00294c87ca5cc2e057f7)
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 <PropertyInfo.h>
13 #include <SerialPort.h>
14 #include <String.h>
15 
16 
17 class BFile;
18 class SerialWindow;
19 
20 
21 class SerialApp: public BApplication
22 {
23 	public:
24 							SerialApp();
25 							~SerialApp();
26 				void		ReadyToRun();
27 				void		MessageReceived(BMessage* message);
28 				bool		QuitRequested();
29 
30 				status_t	GetSupportedSuites(BMessage* message);
31 				BHandler*	ResolveSpecifier(BMessage*, int32, BMessage*, int32,
32 								const char*);
33 
34 		const	BString&	GetPort();
35 
36 	private:
37 				void		LoadSettings();
38 				void		SaveSettings();
39 
40 	private:
41 						BSerialPort		fSerialPort;
42 						sem_id			fSerialLock;
43 						SerialWindow*	fWindow;
44 						BFile*			fLogFile;
45 						BString			fPortPath;
46 
47 		static			status_t		PollSerial(void*);
48 
49 		static const	BPropertyInfo	kScriptingProperties;
50 		static const	char*			kApplicationSignature;
51 };
52 
53 
54 enum messageConstants {
55 	kMsgCustomBaudrate  = 'cust',
56 	kMsgDataRead        = 'dard',
57 	kMsgDataWrite       = 'dawr',
58 	kMsgLogfile         = 'logf',
59 	kMsgOpenPort        = 'open',
60 	kMsgSettings        = 'stty',
61 };
62 
63 #endif
64