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
14
15class BFile;
16class SerialWindow;
17
18
19class SerialApp: public BApplication
20{
21	public:
22		SerialApp();
23		~SerialApp();
24		void ReadyToRun();
25		void MessageReceived(BMessage* message);
26
27	private:
28		BSerialPort fSerialPort;
29		sem_id fSerialLock;
30		SerialWindow* fWindow;
31		BFile* fLogFile;
32
33		static status_t PollSerial(void*);
34
35		static const char* kApplicationSignature;
36};
37
38
39enum messageConstants {
40	kMsgDataRead  = 'dare',
41	kMsgDataWrite = 'dawr',
42	kMsgLogfile   = 'logf',
43	kMsgOpenPort  = 'open',
44	kMsgSettings  = 'stty',
45};
46
47#endif
48