def parse(self,dataType,readData): #print len(readData) x = 0.0 #print readData if(len(readData) == 1): x = ord(readData[0]) elif(len(readData) == 2): x = ord(readData[0])*(2**8)+ord(readData[1]) converted = data.datatype(ord(dataType)).conv(x) if(self.q != None): self.q.put([ord(dataType),converted]) else: print [ord(dataType),converted]
import sys import BaseHTTPServer import os from SimpleHTTPServer import SimpleHTTPRequestHandler import random import time from threading import Thread import parser import data import Queue lastdata = {} for i in range(70): try: # print i, data.datatype(i).name if data.datatype(i).active == 1: lastdata[i] = [data.datatype(i).name, 0] print lastdata[i] except: print "nothing" pass q = Queue.Queue() HandlerClass = SimpleHTTPRequestHandler ServerClass = BaseHTTPServer.HTTPServer Protocol = "HTTP/1.0" speed = 11 if sys.argv[1:]:
def getDataLength(self,dataType): length = data.datatype(ord(dataType)).datalength #print data.datatype(ord(dataType)).name return length