• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ARMmbed / mbed-os-tools / #457

24 Aug 2024 09:15PM UTC coverage: 0.0% (-59.9%) from 59.947%
#457

push

coveralls-python

web-flow
Merge 7c6dbce13 into c467d6f14

0 of 4902 relevant lines covered (0.0%)

0.0 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/mbed_os_tools/test/host_tests_conn_proxy/conn_primitive.py
1
# Copyright (c) 2018, Arm Limited and affiliates.
2
# SPDX-License-Identifier: Apache-2.0
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
#     http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15

16
from ..host_tests_logger import HtrunLogger
×
17

18

19
class ConnectorPrimitiveException(Exception):
×
20
    """
21
    Exception in connector primitive module.
22
    """
23
    pass
×
24

25

26
class ConnectorPrimitive(object):
×
27

28
    def __init__(self, name):
×
29
        self.LAST_ERROR = None
×
30
        self.logger = HtrunLogger(name)
×
31
        self.polling_timeout = 60
×
32

33
    def write_kv(self, key, value):
×
34
        """! Forms and sends Key-Value protocol message.
35
        @details On how to parse K-V sent from DUT see KiViBufferWalker::KIVI_REGEX
36
                 On how DUT sends K-V please see greentea_write_postamble() function in greentea-client
37
        @return Returns buffer with K-V message sent to DUT on success, None on failure
38
        """
39
        # All Key-Value messages ends with newline character
40
        kv_buff = "{{%s;%s}}"% (key, value) + '\n'
×
41

42
        if self.write(kv_buff):
×
43
            self.logger.prn_txd(kv_buff.rstrip())
×
44
            return kv_buff
×
45
        else:
46
            return None
×
47

48
    def read(self, count):
×
49
        """! Read data from DUT
50
        @param count Number of bytes to read
51
        @return Bytes read
52
        """
53
        raise NotImplementedError
×
54

55
    def write(self, payload, log=False):
×
56
        """! Read data from DUT
57
        @param payload Buffer with data to send
58
        @param log Set to True if you want to enable logging for this function
59
        @return Payload (what was actually sent - if possible to establish that)
60
        """
61
        raise NotImplementedError
×
62

63
    def flush(self):
×
64
        """! Flush read/write channels of DUT """
65
        raise NotImplementedError
×
66

67
    def reset(self):
×
68
        """! Reset the dut
69
        """
70
        raise NotImplementedError
×
71

72
    def connected(self):
×
73
        """! Check if there is a connection to DUT
74
        @return True if there is conenction to DUT (read/write/flush API works)
75
        """
76
        raise NotImplementedError
×
77

78
    def error(self):
×
79
        """! Returns LAST_ERROR value
80
        @return Value of self.LAST_ERROR
81
        """
82
        return self.LAST_ERROR
×
83

84
    def finish(self):
×
85
        """! Handle DUT dtor like (close resource) operations here
86
        """
87
        raise NotImplementedError
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc