4Copyright (c) 2011-2016 ARM Limited
6Licensed under the Apache License, Version 2.0 (the "License");
7you may not use this file except in compliance with the License.
8You may obtain a copy of the License at
10 http://www.apache.org/licenses/LICENSE-2.0
12Unless required by applicable law or agreed to
in writing, software
13distributed under the License
is distributed on an
"AS IS" BASIS,
14WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied.
15See the License
for the specific language governing permissions
and
16limitations under the License.
19from mbed_host_tests.host_tests_logger import HtrunLogger
22class ConnectorPrimitiveException(Exception):
24 Exception in connector primitive module.
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.
write(kv_buff):
46 self.
logger.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
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.
Yet another logger flavour.