Esempio n. 1
0
 def post(self):
     strip = self.get_argument('serverip')
     port = self.get_argument('serverport')
     EnableInfo = self.get_argument('EnableInfo')
     if strip and port:
         USBI = USBIAgree5G.get_instances(strip, port)
         if USBI:
             USBI.sendMsg('020f', EnableInfo=EnableInfo)
             result = {'result': 0}
             return_data = json.dumps(result, ensure_ascii=False)
             self.write(return_data)
Esempio n. 2
0
 def post(self):
     strip = self.get_argument('serverip')
     port = self.get_argument('serverport')
     avn_cmd = self.get_argument('reset_value')
     if strip and port:
         USBI = USBIAgree5G.get_instances(strip, port)
         if USBI:
             USBI.msg_que.put_nowait(unhexlify(encode(avn_cmd)))
             result = {'result': 0}
             return_data = json.dumps(result, ensure_ascii=False)
             self.write(return_data)
Esempio n. 3
0
 def post(self):
     strip = self.get_argument('serverip')
     port = self.get_argument('serverport')
     avn_cmd = self.get_argument('log_value')
     if strip and port:
         USBI = USBIAgree5G.get_instances(strip, port)
         if USBI:
             USBI.sendMsg('0110', RemoteGetLog=avn_cmd)
             USBI.getLog(avn_cmd)
             result = {'result': 0}
             return_data = json.dumps(result, ensure_ascii=False)
             self.write(return_data)
Esempio n. 4
0
 def post(self):
     strip = self.get_argument('serverip')
     port = self.get_argument('serverport')
     if strip and port:
         USBI = USBIAgree5G.get_instances(strip, port)
         session = USBI.session
         if session:
             USBI.nosendlist.append('0301')
             USBI.nosendlist.append('0304')
             result = {'result': 0}
             return_data = json.dumps(result, ensure_ascii=False)
             self.write(return_data)
Esempio n. 5
0
 def post(self):
     strip = self.get_argument('serverip')
     port = self.get_argument('serverport')
     reset_value = self.get_argument('reset_value')
     if strip and port:
         USBI = USBIAgree5G.get_instances(strip, port)
         session = USBI.session
         if session:
             USBI.sendMsg('0209',reset_value=reset_value)
             result = {'result': 0}
             return_data = json.dumps(result, ensure_ascii=False)
             self.write(return_data)
Esempio n. 6
0
 def post(self):
     strip = self.get_argument('serverip')
     port = self.get_argument('serverport')
     wifiFlag = self.get_argument('wifiFlag')
     wifipwd = self.get_argument('wifipwd')
     wifiFrequency = self.get_argument('wifiFrequency')
     if strip and port:
         USBI = USBIAgree5G.get_instances(strip, port)
         if USBI:
             USBI.sendMsg('020E', wifiFlag=wifiFlag, wifipwd=wifipwd, wifiFrequency=wifiFrequency)
             result = {'result': 0}
             return_data = json.dumps(result, ensure_ascii=False)
             self.write(return_data)
Esempio n. 7
0
 def put(self):
     try:
         result = {'result': 0, 'Conn': 0}
         host = self.get_argument('serverip')
         port = self.get_argument('serverport')
         return_data = json.dumps(result, ensure_ascii=False)
         usbi = USBIAgree5G.get_instances(host, port)
         if usbi.session:
             usbi.handle_close()
         self.write(return_data)
     except Exception as e:
         result = {'result': -1, 'Conn': 1, 'error': e}
         return_data = json.dumps(result, ensure_ascii=False)
         self.write(return_data)
Esempio n. 8
0
 def response_msg(self):
     strip = self.get_argument('serverip')
     port = self.get_argument('serverport')
     index = self.get_argument('index')
     cmd = USBI_CMD_DICT.get(index)
     if strip and port:
         USBI = USBIAgree5G.get_instances(strip, port)
         session = USBI.session
         if session:
             result_return = USBI.sendMsg(cmd)
             result = {'result': 0, 'Conn': 1, 'result_return': str(result_return)}
             return_data = json.dumps(result, ensure_ascii=False)
             return return_data
         else:
             result = {'result': -1, 'Conn': 1, 'error': 'connect tcp error'}
             return_data = json.dumps(result, ensure_ascii=False)
             return return_data
Esempio n. 9
0
    def post(self):
        try:
            host = self.get_argument('serverip')
            port = self.get_argument('serverport')
            USBI = USBIAgree5G.get_instances(host, port)
            USBI.connect_socket()
            session = USBI.session

            #with closing(session):
            if session:
                USBI.sendMsg('0001')

                result = {'result': 0, 'Conn': 1}
                return_data = json.dumps(result, ensure_ascii=False)
                self.write(return_data)

        except Exception as e:
            result = {'result': 1, 'Conn': 1, 'error': e}
            return_data = json.dumps(result, ensure_ascii=False)
            self.write(return_data)
Esempio n. 10
0
    def post(self):
        try:
            strip = self.get_argument('serverip')
            port = self.get_argument('serverport')
            DataValue = self.get_argument('DataValue')
            cmd = '0207'
            if strip and port:
                USBI = USBIAgree5G.get_instances(strip, port)
                session = USBI.session
                if session:
                    USBI.sendMsg(cmd, DataValue=DataValue)
                    result = {'result': 0, 'Conn': 1}
                    return_data = json.dumps(result, ensure_ascii=False)
                    self.write(return_data)
                else:
                    result = {'result': -1, 'Conn': 1, 'error': 'connect tcp error'}
                    return_data = json.dumps(result, ensure_ascii=False)
                    self.write(return_data)

        except Exception as e:
            result = {'result': -1, 'Conn': 1, 'error': e}
            return_data = json.dumps(result, ensure_ascii=False)
            self.write(return_data)
Esempio n. 11
0
    def post(self):
        try:
            strip = self.get_argument('serverip')
            port = self.get_argument('serverport')
            ex_ECU_ID = self.get_argument('ex_ECU_ID')
            ReflashReqInfo = self.get_argument('ReflashReqInfo')
            cmd = '0208'
            if strip and port:
                USBI = USBIAgree5G.get_instances(strip, port)
                session = USBI.session
                if session:
                    USBI.sendMsg(cmd, ex_ECU_ID=ex_ECU_ID, ReflashReqInfo=ReflashReqInfo)
                    result = {'result': 0, 'Conn': 1}
                    return_data = json.dumps(result, ensure_ascii=False)
                    self.write(return_data)
                else:
                    result = {'result': -1, 'Conn': 1, 'error': 'connect tcp error'}
                    return_data = json.dumps(result, ensure_ascii=False)
                    self.write(return_data)

        except Exception as e:
            result = {'result': -1, 'Conn': 1, 'error': e}
            return_data = json.dumps(result, ensure_ascii=False)
            self.write(return_data)
Esempio n. 12
0
    def put(self):
        try:
            strip = self.get_argument('serverip')
            port = self.get_argument('serverport')
            index = self.get_argument('index')
            cmd = index.lower()
            if strip and port:
                USBI = USBIAgree5G.get_instances(strip, port)
                session = USBI.session
                if session:
                    USBI.sendMsg(cmd)
                    result = {'result': 0, 'Conn': 1}
                    return_data = json.dumps(result, ensure_ascii=False)
                    self.write(return_data)
                else:
                    result = {'result': -1, 'Conn': 1, 'error': 'connect tcp error'}
                    return_data = json.dumps(result, ensure_ascii=False)
                    self.write(return_data)

        except Exception as e:
            print(e)
            result = {'result': -1, 'Conn': 1, 'error': e}
            return_data = json.dumps(result, ensure_ascii=False)
            self.write(return_data)