4 Copyright (c) 2011-2016 ARM Limited
6 Licensed under the Apache License, Version 2.0 (the "License");
7 you may not use this file except in compliance with the License.
8 You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
24 Exception in connector primitive module.
33 self.
loggerlogger = HtrunLogger(name)
37 """! Forms and sends Key-Value protocol message.
38 @details On how to parse K-V sent from DUT see KiViBufferWalker::KIVI_REGEX
39 On how DUT sends K-V please see greentea_write_postamble() function in greentea-client
40 @return Returns buffer with K-V message sent to DUT on success, None on failure
43 kv_buff =
"{{%s;%s}}"% (key, value) +
'\n'
45 if self.
writewrite(kv_buff):
46 self.
loggerlogger.prn_txd(kv_buff.rstrip())
52 """! Read data from DUT
53 @param count Number of bytes to read
56 raise NotImplementedError
58 def write(self, payload, log=False):
59 """! Read data from DUT
60 @param payload Buffer with data to send
61 @param log Set to True if you want to enable logging for this function
62 @return Payload (what was actually sent - if possible to establish that)
64 raise NotImplementedError
67 """! Flush read/write channels of DUT """
68 raise NotImplementedError
73 raise NotImplementedError
76 """! Check if there is a connection to DUT
77 @return True if there is conenction to DUT (read/write/flush API works)
79 raise NotImplementedError
82 """! Returns LAST_ERROR value
83 @return Value of self.LAST_ERROR
88 """! Handle DUT dtor like (close resource) operations here
90 raise NotImplementedError
def write(self, payload, log=False)
Read data from DUT.
def write_kv(self, key, value)
Forms and sends Key-Value protocol message.
def finish(self)
Handle DUT dtor like (close resource) operations here.
def flush(self)
Flush read/write channels of DUT.
def read(self, count)
Read data from DUT.
def reset(self)
Reset the dut.
def error(self)
Returns LAST_ERROR value.
def connected(self)
Check if there is a connection to DUT.