~aleteoryx/muditaos

ref: 1a6ea1f4b3eb85b3c3018ecf51016cb35d5172cb muditaos/test/phone_switch_app.py -rw-r--r-- 880 bytes
1a6ea1f4 — Alek Rudnik [EGD-4205] mudita 1st audio assets (#940) 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/python3
# Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
# For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

# script walking on desktop
from harness.common import Serial
import logging
import json

log = logging.getLogger(__name__)
logging.basicConfig(format='%(asctime)s %(message)s', level=logging.DEBUG)
conn = Serial()


def cmd_json(data):
    ret = {}
    try:
        ret = json.loads(data)
    except Exception as ex:
        print(ex)
    return ret


# get in sms and back 100 times
for el in range(1, 100):
    log.info("TEST ex: {}".format(el))
    # back
    # move left , enter, read for entry
    conn.key(ord('d'))
    conn.key(ord('d'))
    conn.key(ord('\n'))
    data = cmd_json(conn.read(4))
    log.debug(data)
    conn.sleep(1)
    conn.key(12)
    conn.sleep(1)
    data = cmd_json(conn.read(4))
    log.debug(data)