コード例 #1
0
def com_unregisterfun(cmd, data, port):
    #print(hex(cmd),':',binascii.hexlify(data).upper())
    frame = packet.get_packet(cmd, data, len(data))
    mqtt.mqtt_pub(config.mqtt_topic_tx_header + bs_id, frame)


com_prase = prase.prase_class_init("com_prase", com_mq, com_unregisterfun)
'''
MQTT数据
'''
mqtt_mq = Queue()
sub_list = list()
sub_list.append(config.mqtt_topic_rx_header + bs_id)
print("服务器IP:", config.mqtt_broker_ip)
mqtt = MqttThread.mqtt_thread_init(config.mqtt_broker_ip, sub_list, mqtt_mq)

average_period = 3
wifi_seq = 0


def wifi_hb_send():
    global wifi_seq
    rate_timer = threading.Timer(average_period, wifi_hb_send)
    rate_timer.start()
    data = struct.pack("<HIIbB3s6sBBH", int(bs_id, 16), 0x01, 0x09, -50, 0x03,
                       b'123', b'\1\2\3\4\5\6', 0x3, 0x1, wifi_seq)
    wifi_seq += 1
    frame = packet.get_packet(0x0A80, data, len(data))
    com_instance.send(frame, len(frame))
    mqtt.mqtt_pub(config.mqtt_topic_tx_header + bs_id, frame)
コード例 #2
0
from components.MQTT import MqttThread
from components.PacketPrase import prase

from components.Figures import Figures

mq = Queue()
sub_list = list()

        
if(len(sys.argv ) > 1):
    for i in range(1,len(sys.argv)):
        sub_list.append("/EH100602/tx/"+sys.argv[i])
else:
    sub_list.append("/EH100602/tx/#")
#sub_list.append("/EH100602/rx/#")
mqtt = MqttThread.mqtt_thread_init("192.168.0.158",sub_list,mq)




def un_register(cmd,data,port):
    #print(hex(cmd),binascii.hexlify(data))
    pass

mqtt_prase = prase.prase_class_init("mqtt_prase",mq,un_register)



show = dict()

#show["figure_bs_unix_ts"] = dict()
コード例 #3
0
from components.PacketPrase import prase

import json

mq = Queue()
sub_list = list()

        
if(len(sys.argv ) > 1):
    for i in range(1,len(sys.argv)):
        sub_list.append("/EH100602/tx/"+sys.argv[i])
else:
    sub_list.append("/EH100602/tx/#")
#sub_list.append("/EH100602/rx/#")
print("服务器IP:",config.mqtt_broker_ip)
mqtt = MqttThread.mqtt_thread_init(config.mqtt_broker_ip,sub_list,mq)

xyz_mq = Queue()
xyz_mqtt = MqttThread.mqtt_thread_init(config.mqtt_broker_ip,["/LocXYZ/#"],xyz_mq)


def un_register(cmd,data,port):
    #print(hex(cmd),binascii.hexlify(data))
    pass

mqtt_prase = prase.prase_class_init("mqtt_prase",mq,un_register)



p_2a0a_dict = dict()
def Prase_2A16_Test(data,l,port):
コード例 #4
0
show["figure_wifi_tx"] = dict()
show["figure_wifi_tx"]["xmax"] = 1000
show["figure_wifi_tx"]["show"] = dict()
show["figure_wifi_tx"]["ylabel"] = "Bytes"
        
show["figure_wifi_rx"] = dict()
show["figure_wifi_rx"]["xmax"] = 1000
show["figure_wifi_rx"]["show"] = dict()


time.sleep(1)
#show_instance = Figures.FiguresInit("show",show)
time.sleep(1)

mqtt = MqttThread.mqtt_thread_init("192.168.100.139",sub_list,mq)

average_rate_dict = dict()

'''
def calc_rate():
    global average_dict,show

    #print("calc_rate")
    rate_timer = threading.Timer(average_period, calc_rate)
    rate_timer.start()
    
    for rate_id in average_rate_dict.keys():
        
        if((rate_id in show["figure_wifi_tx"]["show"].keys()) == False):
            show["figure_wifi_tx"]["show"][rate_id] = dict()
コード例 #5
0
from components.MQTT import MqttThread
from components.PacketPrase import prase

mq = Queue()
sub_list = list()
#sub_list.append("/EH100602/tx/"+"fefc")
#sub_list.append("/EH100602/tx/"+sys.argv[1])
#sub_list.append("/EH100602/tx/#")
if (len(sys.argv) > 1):
    for i in range(1, len(sys.argv)):
        sub_list.append("/EH100602/tx/" + sys.argv[i])
else:
    sub_list.append("/EH100602/tx/#")

mqtt = MqttThread.mqtt_thread_init("192.168.4.44", sub_list, mq)


def un_register(cmd, data, port):
    #print(hex(cmd),binascii.hexlify(data))
    pass


mqtt_prase = prase.prase_class_init("mqtt_prase", mq, un_register)
'''
{
"bs_id":{
         "rssi":xxx,
         "cnt",xxx
        } 
}