예제 #1
0
파일: uicr.py 프로젝트: yogiD/nRF52_Mesh
import os
import pylink
import cfg
import sys

nodes = cfg.get_local_nodes(os.environ['NODES_CONFIG'])

#  command example
#  python uicr.py "../applications/uicr_map.json"
if(len(sys.argv) > 1):
    uicr_cfongi_file = sys.argv[1]
    print("arg0:%s"%(uicr_cfongi_file))
else:
    uicr_cfongi_file = "../applications/uicr_map.json"

#second command line argument to read or write
if(len(sys.argv) > 2):
    mode = sys.argv[2]
    print("arg1:%s"%(mode))
else:
    mode = "-x"

uicr = cfg.get_local_nodes(uicr_cfongi_file)
jlink = pylink.JLink()
jlink.open(os.environ['SEG_JLEDU'])
node_id = 0
node = {}

def get_node_id_from_uid(uid):
    res =""
    for key,val in nodes.items():
예제 #2
0
on_broadcast = None
on_message = None
on_cmd_response = None

config = cfg.configure_log(__file__)
nodes_config_file = '/home/pi/nRF52_Mesh/nodes.json'
if ("config" in config["mesh"]):
    nodes_config_file = config["mesh"]["config"]
log.info("mesh> using NODES_CONFIG : %s", nodes_config_file)
if (nodes_config_file.startswith("http")):
    response = requests.get(nodes_config_file)
    nodes = response.json()
    log.info(f" => {len(nodes)} nodes")
else:
    nodes = cfg.get_local_nodes(nodes_config_file)

pid = {
    "exec_cmd": 0xEC,
    "ping": 0x01,
    "request_pid": 0x02,
    "chan_switch": 0x03,
    "reset": 0x04,
    "alive": 0x05,
    "button": 0x06,
    "light": 0x07,
    "temperature": 0x08,
    "heat": 0x09,
    "bme280": 0x0A,
    "rgb": 0x0B,
    "magnet": 0x0C,
예제 #3
0
import cfg
import serial_wrapper as ser
import datetime
import time

nodes = cfg.get_local_nodes("../../config/nodes.json")

pid = {
    "exec_cmd": 0xEC,
    "ping": 0x01,
    "request_pid": 0x02,
    "chan_switch": 0x03,
    "reset": 0x04,
    "alive": 0x05,
    "button": 0x06,
    "light": 0x07,
    "temperature": 0x08,
    "heat": 0x09,
    "bme280": 0x0A,
    "rgb": 0x0B,
    "magnet": 0x0C,
    "dimmer": 0x0D,
    "light_rgb": 0x0E,
    "gesture": 0x0F,
    "proximity": 0x10,
    "humidity": 0x11,
    "pressure": 0x12,
    "acceleration": 0x13,
    "light_n": 0x14,
    "battery": 0x15,
    "test_rf_resp": 0x30