Beispiel #1
0
	def handle(self) :
		request = iod_proto.read_message(self.request)

		msg = {iod_proto.SLOT_STATUS : iod_proto.STATUS_FAIL}
		try :
			if request[iod_proto.SLOT_OP] == iod_proto.OP_RESET :
				msg = self.server.op_reset()
			elif request[iod_proto.SLOT_OP] == iod_proto.OP_SETUP :
				msg = self.server.op_setup(request[iod_proto.SLOT_ARG])
			elif request[iod_proto.SLOT_OP] == iod_proto.OP_SAMPLE :
				msg = self.server.op_sample(request[iod_proto.SLOT_ARG])
			elif request[iod_proto.SLOT_OP] == iod_proto.OP_SET :
				msg = self.server.op_set(request[iod_proto.SLOT_ARG])
			else :
				print 'unk op: %d' % request[iod_proto.SLOT_OP]
		except :
			print 'caught exception in handler'
		iod_proto.write_message(self.request, msg)