RDK Documentation (Open Sourced RDK Components)
DriverImpl.hpp
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 
21 
22 /**
23 * @defgroup hdmicec
24 * @{
25 * @defgroup ccec
26 * @{
27 **/
28 
29 
30 #ifndef HDMI_CCEC_DRIVER_IMPL_HPP_
31 #define HDMI_CCEC_DRIVER_IMPL_HPP_
32 
33 #include <list>
34 
35 #include "osal/Mutex.hpp"
36 #include "osal/EventQueue.hpp"
37 
39 #include "ccec/Driver.hpp"
40 
42 using CCEC_OSAL::Mutex;
43 
44 CCEC_BEGIN_NAMESPACE
45 
46 class IncomingQueue;
47 
48 class DriverImpl : public Driver
49 {
50 public:
51  static void DriverReceiveCallback(int handle, void *callbackData, unsigned char *buf, int len);
52  static void DriverTransmitCallback(int handle, void *callbackData, int result);
54 
55  enum {
56  CLOSED = 0,
57  CLOSING,
58  OPENED,
59  };
60  DriverImpl(void);
61  virtual ~DriverImpl();
62 
63  virtual void open(void) throw(InvalidStateException, IOException);
64  virtual void close(void) throw(InvalidStateException, IOException);
65  virtual void read(CECFrame &frame) throw(InvalidStateException, IOException);
66  virtual void write(const CECFrame &frame) throw(InvalidStateException, IOException, CECNoAckException);
67  virtual void writeAsync(const CECFrame &frame) throw(InvalidStateException, IOException, CECNoAckException);
68  virtual void removeLogicalAddress(const LogicalAddress &source);
69  virtual bool addLogicalAddress (const LogicalAddress &source);
70  virtual int getLogicalAddress(int devType);
71  virtual void getPhysicalAddress(unsigned int *physicalAddress);
72 // virtual const std::list<LogicalAddress> & getLogicalAddresses(void);
73  virtual bool isValidLogicalAddress(const LogicalAddress &source) const;
74  virtual void poll(const LogicalAddress &from, const LogicalAddress &to) throw(InvalidStateException, IOException, CECNoAckException);
75 
76 private:
77  IncomingQueue & getIncomingQueue(int nativeHandle);
78 
79  int status;
80  int nativeHandle;
81  IncomingQueue rQueue;
82  Mutex mutex;
83  std::list<LogicalAddress> logicalAddresses;
84 
85  DriverImpl(const DriverImpl &); /* Not allowed */
86  DriverImpl & operator = (const DriverImpl &); /* Not allowed */
87 
88 };
89 
90 CCEC_END_NAMESPACE
91 
92 #endif
93 
94 
95 /** @} */
96 /** @} */
CCEC_OSAL::Mutex
Definition: Mutex.hpp:53
Driver
Definition: Driver.hpp:45
CECNoAckException
Definition: Exception.hpp:52
DriverImpl
Definition: DriverImpl.hpp:48
EventQueue.hpp
This file defines interface of EventQueue class.
IOException
Definition: Exception.hpp:71
LogicalAddress
Definition: Operands.hpp:409
CCEC_OSAL::EventQueue
Definition: EventQueue.hpp:62
ConditionVariable.hpp
This file defines interface of ConditionVariable class.
InvalidStateException
Definition: Exception.hpp:81
Mutex.hpp
This file defines interface of Mutex class.
CECFrame
Definition: CECFrame.hpp:40