RDK Documentation (Open Sourced RDK Components)
Driver.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_HPP_
31 #define _HDMI_CCEC_DRIVER_HPP_
32 
33 #include <queue>
34 #include <list>
35 
36 #include "osal/Mutex.hpp"
37 #include "ccec/Exception.hpp"
38 #include "CECFrame.hpp"
39 #include "Operands.hpp"
40 
41 using CCEC_OSAL::Mutex;
42 
43 CCEC_BEGIN_NAMESPACE
44 
45 class Driver {
46 public:
47  static Driver &getInstance(void);
48 
49  enum {
50  SENT_AND_ACKD, //On the bus and destination device ack'd
51  SENT_FAILED = 1, //Not getting on the bus.
52  SENT_BUT_NOT_ACKD, //On the bus but no destination device.
53  };
54 
55 
56  Driver(void) {};
57 
58  virtual void open(void) throw(InvalidStateException, IOException) = 0;
59  virtual void close(void) throw(InvalidStateException, IOException)= 0;
60  virtual void read(CECFrame &frame) throw(InvalidStateException, IOException) = 0;
61  virtual void write(const CECFrame &frame) throw(InvalidStateException, IOException, CECNoAckException) = 0;
62  virtual void writeAsync(const CECFrame &frame) throw(InvalidStateException, IOException, CECNoAckException) = 0;
63  virtual void removeLogicalAddress(const LogicalAddress &source) = 0;
64  virtual bool addLogicalAddress (const LogicalAddress &source) = 0;
65 // virtual void getLogicalAddress(int devType, int *logicalAddress) = 0;
66  virtual int getLogicalAddress(int devType) = 0;
67  virtual void getPhysicalAddress(unsigned int *physicalAddress) = 0;
68  virtual bool isValidLogicalAddress(const LogicalAddress &source) const = 0;
69  virtual void poll(const LogicalAddress &from, const LogicalAddress &to) throw(InvalidStateException, IOException, CECNoAckException) = 0;
70 
71  virtual ~Driver(void) {};
72 protected:
73 
74 private:
75  static Mutex instanceMutex;
76 };
77 
78 CCEC_END_NAMESPACE
79 #endif
80 
81 
82 /** @} */
83 /** @} */
CCEC_OSAL::Mutex
Definition: Mutex.hpp:53
Driver
Definition: Driver.hpp:45
CECNoAckException
Definition: Exception.hpp:52
IOException
Definition: Exception.hpp:71
LogicalAddress
Definition: Operands.hpp:409
InvalidStateException
Definition: Exception.hpp:81
Mutex.hpp
This file defines interface of Mutex class.
CECFrame
Definition: CECFrame.hpp:40