1
Developers / ruby initialise command vs receive buffer
« on: December 09, 2010, 11:04:36 am »Hi!
Starting off as always to excuse myself for posting, maybe even in the wrong section(?)
Anyway. a pointer to a page where these things are described would be as appreciated as giving pointers to what is not ok.
What is wrong with my initialise command?
I assume the answer from the device is handled correct, hence the device getting disabled upon quick reload(if power is on in this case) since I tried to change the first buf.index
to 001 and then it does register ok.
Can the init command not put devices as enabled? (i.e unclick the disabled button)
Goal: when init send power question, if receive 000(power off) set device as enabled
if receive 001(power on) set device as enabled
If no response at all, then disable device..
Code: [Select]
#31-Nov-10 14:13 init Panasonic AE3000
initok=false
for iRetry in 0...4
print "Initializing unit\n"
conn_.Send("\x02QPW\x03\r")
buf = conn_.Recv(100, 500)
if( !buf.nil? && !buf.index("000").nil? )
print "Initialized ok\n"
initok=true
if( !buf.nil? && !buf.index("001").nil? )
print "Initialized ok\n"
initok=true
break
else
print "Didn't respond to command\n"
end
end
if initok==false
DisableDevice( device_.devid_, true )
print "The device wouldn't respond. Disabling it.\n"
return
end
if initok==true
DisableDevice( device_.devid_, false )
print "The device responded. Enabling it.\n"
return
end
print "Initialized ok, doing log\n"
end
Below is the receive command(also copied from onkyo template)
I am not sure it is correct either, seems like it is reffered to in the init command but then it seem to be misspelled?
I guess it listens for what comes but what is the things between supposed to do " " ?
I guess this what's expected from the device?
Code: [Select]
buff = conn_.RecvDelimited("\1a", -1)
print buff,"\n"
Br
Johan