Merge "Fix memory leaks in Locales" into tizen_2.1
[platform/framework/native/appfw.git] / src / io / FIo_SerialPortImpl.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://floralicense.org/license/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 /**
19  * @file        FIo_SerialPortImpl.h
20  * @brief       This is the header file for the %_SerialPortImpl class.
21  *
22  * This header file contains the declarations of the %_SerialPortImpl class.
23  */
24
25 #ifndef _FIO_INTERNAL_SERIALPORT_IMPL_H_
26 #define _FIO_INTERNAL_SERIALPORT_IMPL_H_
27
28 #include <FBaseRtEvent.h>
29 #include <FIo.h>
30 #include <FIoISerialPortEventListener.h>
31 #include <FIo_IIpcClientEventListener.h>
32 #include <FSys_ICommunicationDispatcherListener.h>
33
34 namespace Tizen { namespace Base { namespace Collection {
35 class ArrayList;
36 }}}
37
38 namespace Tizen { namespace Io
39 {
40
41 class _SerialPortImpl
42         : public Tizen::System::_ICommunicationDispatcherListener
43 {
44 private:
45         _SerialPortImpl();
46         virtual ~_SerialPortImpl(void);
47 public:
48         result SerialOpen(void);
49         result SerialClose(void);
50         bool IsOpended(void);
51
52         result SetSerialPortEventListener(ISerialPortEventListener& listener);
53         result Write(const Tizen::Base::ByteBuffer &byteBuffer);
54         int GetWriteBufferSize(void) const;
55         void OnDataReceived(const Tizen::Base::Collection::ArrayList& data);
56
57         static _SerialPortImpl* GetInstance(void);
58
59 private:
60         _IpcClient*                     __pIpcClient;
61         Tizen::Base::Runtime::Event*    __pEvent;
62         bool                            __isOpended;
63
64         _SerialPortImpl(_SerialPortImpl& serialPortImpl);
65
66         _SerialPortImpl& operator =(const _SerialPortImpl& serialPortImpl);
67
68         static _SerialPortImpl* __pSerialPortImpl;
69 };
70
71 }} //Tizen::Io
72
73 #endif // _FIO_INTERNAL_SERIALPORT_IMPL_H_