本文整理汇总了Python中Command.Command.getCommand方法的典型用法代码示例。如果您正苦于以下问题:Python Command.getCommand方法的具体用法?Python Command.getCommand怎么用?Python Command.getCommand使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Command.Command
的用法示例。
在下文中一共展示了Command.getCommand方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sendCommand
# 需要导入模块: from Command import Command [as 别名]
# 或者: from Command.Command import getCommand [as 别名]
def sendCommand(f):
print '--------- Datalogger Simulator -----------'
while len(sensorReceiver) > 0:
print 'Ingrese uno de los siguientes comandos:'
for key,val in sorted(command.items()):
print " "*5,key, ":", val
commandInput = raw_input('>>')
if command.has_key(commandInput):
print 'Ingrese un sensor destinatario'
for key,val in sorted(sensorReceiver.items()):
print " "*5,key, ":", val
sensorInput = raw_input('>>')
if sensorReceiver.has_key(sensorInput):
if commandInput == '1':
frequency = 0
elif commandInput == '2':
print 'Ingrese una valor de frecuencia'
frequency = raw_input('>>')
else:
frequency = 0
comando = Command(sensorReceiver[sensorInput],'client03' , 5, 100, ' ',command[commandInput], frequency)
com.send(comando)
f.write(comando.getReceiver().center(15)+ comando.getCommand().center(10) +str(comando.getValue()).center(10)
+'-'.center(10)+'-'.center(10)+ time.strftime("%H:%M:%S").center(10)+'\n')
if commandInput == '3':
del sensorReceiver[sensorInput];
else:
print 'el sensor no existe\n'
else:
print 'comando erroneo\n'
exit(0)