def render_device_scribe(device_name, tags="ALL_TAGS_NAME", expand=False): tags = tags.replace(" ","").split(',') tagdata = lj_device_scribe.get_all_registers_grouped_by_tags(device_name, tags, ljmmm.get_registers_data(expand_names=False, inc_orig=False)) combined_scribe_data = "" for x in tagdata: combined_scribe_data += render_scribe(x,expand) return combined_scribe_data
def get_all_tags(): tags = "" tagjson = ljmmm.get_registers_data(expand_names=False, inc_orig=False) for register in tagjson: for tag in register["tags"]: if (tag not in tags): tags += tag + "," return tags[:-1].replace(" ", "").split(',')
""" import json import os import flask from flask import Markup, request from ljm_constants import ljmmm import lj_scribe import parse_ljsl import serialize app = flask.Flask(__name__) reg_data_compressed = ljmmm.get_registers_data(expand_names=False, inc_orig=False) reg_data_expanded = ljmmm.get_registers_data(expand_names=True, inc_orig=False) modbus_maps = ljmmm.get_device_modbus_maps() ALL_DEVICES_NAME = "All Devices" ALL_TAGS_NAME = "All Tags" INVALID_FILTER_ARGUMENTS = ["null", "undefined"] OPTION_TAG_TEMLPATE = '<option value="{tag}">{tag}</option>' SELECTED_OPTION_TAB_TEMPLATE = '<option value="{tag}" selected="selected">' "{tag}</option>" ALLOWED_REDISPLAY_DOMAIN = "https://labjack.com" # NO_TAGS_NAME = "No Tags" @app.route("/") def show_ui(): """Display the JavaScript client for viewing MODBUS map information.
def test_empty_tag(self): tags = lj_device_scribe.get_all_registers_grouped_by_tags( "T4", ["WIFI"], ljmmm.get_registers_data(expand_names=False, inc_orig=False)) self.assertEqual(EXPECTED_REGISTERS_EMPTY, tags)
def test_get_registers_for_tag(self): tags = lj_device_scribe.get_all_registers_grouped_by_tags( "T7", ["TDAC"], ljmmm.get_registers_data(expand_names=False, inc_orig=False)) self.assertEqual(EXPECTED_REGISTERS, tags)
import json import os import flask from flask import Markup, request from ljm_constants import ljmmm import lj_error_scribe import lj_scribe import lj_device_scribe import parse_ljsl import serialize app = flask.Flask(__name__) reg_data_compressed = ljmmm.get_registers_data(expand_names=False, inc_orig=False) reg_data_expanded = ljmmm.get_registers_data(expand_names=True, inc_orig=False) modbus_maps = ljmmm.get_device_modbus_maps() reg_maps = ljmmm.get_device_modbus_maps(expand_names=True, inc_orig=True) ALL_DEVICES_NAME = u"All Devices" ALL_TAGS_NAME = u"All Tags" INVALID_FILTER_ARGUMENTS = ["null", "undefined"] OPTION_TAG_TEMLPATE = "<option value=\"{tag}\">{tag}</option>" SELECTED_OPTION_TAB_TEMPLATE = "<option value=\"{tag}\" selected=\"selected\">" \ "{tag}</option>" ALLOWED_REDISPLAY_DOMAIN = "https://labjack.com" # NO_TAGS_NAME = "No Tags" @app.route("/") def show_ui():