Exemplo n.º 1
0
	def run(self):
		triggerId = globaldef.triggers.getTriggerId(self.triggerName, self.triggerArg)
		message = (12 << (15*8)) + (triggerId << (13*8)) + (argVal << (9*8))
		s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
		s.connect(('192.168.0.198', self.port)) #TODO store the address globally
		s.sendall(numToString(message,16))
		answ = s.recv(16)
		
		answ_command = (answ >> (15*8)) & 0xFF
		answ_triggerId = (answ >> (13*8)) & 0xFFFF
		if not (command == 14 and answ_triggerId == triggerId):
			print("There was an error during triggering...") #TODO error handlig is gonna take place here
			
		s.close()
Exemplo n.º 2
0
    def run(self):
        triggerId = globaldef.triggers.getTriggerId(self.triggerName,
                                                    self.triggerArg)
        message = (12 << (15 * 8)) + (triggerId << (13 * 8)) + (argVal <<
                                                                (9 * 8))
        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        s.connect(
            ('192.168.0.198', self.port))  #TODO store the address globally
        s.sendall(numToString(message, 16))
        answ = s.recv(16)

        answ_command = (answ >> (15 * 8)) & 0xFF
        answ_triggerId = (answ >> (13 * 8)) & 0xFFFF
        if not (command == 14 and answ_triggerId == triggerId):
            print("There was an error during triggering..."
                  )  #TODO error handlig is gonna take place here

        s.close()
Exemplo n.º 3
0
def doProcessing(data):
	dataNum=stringToNum(data)
	firstByte = (dataNum & (0xFF << (8*15))) >> (8*15)
	
	if firstByte == 1: #ok
		answ = sendId()
	elif firstByte == 3: #ij
		answ = initSetupMode()
	elif firstByte == 4:
		answ = startExec()
	elif firstByte == 5: #
		answ = setArg(dataNum)
	elif firstByte == 6:
		answ = activateTrigger(dataNum)
	elif firstByte == 11:
		answ = handleTrigger(dataNum)
	else:
		answ = 15 << (15*8) # because then there was an error

	return numToString(answ, 16)