how to correctly unset a word?
[1/5] from: petr::krenzelok::trz::cz at: 25-Apr-2003 14:45
Hello,
I have a following scenario when communicating with our device:
ccd: open tcp://some-port:55
.... then we send some instructions, read an image ...
close ccd
but - sometimes there is some transfer problem and scripts waits for
something. Then Rene presses escape, to get back to console - but in
such case, "close ccd" is not applied. When Rene redoes the script, it
tries to connect to our device, but it still may have its port opened
(there is only one tcp socket to use), so we would need to close it
somehow ....
I tried something as following to put at the beginning of the script:
if not value? 'ccd [close ccd]
... but it does not work, becase if everything goes well, script does
what it is supposed to do and closes the connection - next time the
script is redone from console, "value? 'ccd" still returns true so
close ccd
is applied to non-existant port and error is returned. Is
there any chance of anyhow unset the 'ccd value, so if we do the script
from console once again, it looks if 1) port is closed 2) if closed?,
then unsets the value?
Strange thing is:
->> ccd: open tcp://:1024
->> close ccd
->> value? ccd
== true
->> unset 'ccd
->> value? 'ccd
== false
->> unset? 'ccd
== false
Why unset? 'ccd does not return 'true? I am somehow confused about that
stuff :-)
Thanks,
-pekr-
[2/5] from: Steven:White:ci:bloomington:mn:us at: 25-Apr-2003 10:51
>>> [petr--krenzelok--trz--cz] 04/25/03 07:45AM >>>
>>>Hello,
>>>I have a following scenario when communicating with our device:
>>>ccd: open tcp://some-port:55
>>>.... then we send some instructions, read an image ...
>>>close ccd
Pardon the non-coding question, but I am wondering about this:
Does this mean that there exists, or that someone is developing,
a camera that can be controlled by REBOL?
I can think of some personal uses for a computer camera that
I could control by a script. With REBOL, it would be simple to
make the camera take a picture every hour and send it by email
or upload it to a web site. If nothing else, I could spy on the dog.
Thank you.
Steven White
City of Bloomington
2215 W Old Shakopee Rd
Bloomington MN 55431-3096
USA
952-563-4882 (voice)
952-563-4672 (fax)
[swhite--ci--bloomington--mn--us]
[3/5] from: greggirwin:mindspring at: 25-Apr-2003 11:12
Hi Petr,
I'm not sure why unset? returns false, but maybe Romano, Gabriele, or
Ladislav will jump in with an answer.
You could work around it like this:
>> type? get/any 'ccd
== unset!
But, I'm not sure why you need to UNSET the value, rather than just
setting it to NONE when you close the port, and be sure to wrap all your
port accesses with error handlers.
-- Gregg
[4/5] from: greggirwin:mindspring at: 25-Apr-2003 11:47
Hi Steven,
SW> Does this mean that there exists, or that someone is developing,
SW> a camera that can be controlled by REBOL?
SW> I can think of some personal uses for a computer camera that
SW> I could control by a script. With REBOL, it would be simple to
SW> make the camera take a picture every hour and send it by email
SW> or upload it to a web site. If nothing else, I could spy on the dog.
I'm not working with Petr on his product, but I am working on a
project that interfaces with the Canon VB101 camera server and we did
some tests that showed we were able to control T/P/Z (Tilt/Pan/Zoom)
cameras remotely with REBOL. The hardware would be pricey just for
spying on the dog though.
-- Gregg
[5/5] from: antonr:iinet:au at: 26-Apr-2003 14:47
Do this at the beginning of your script:
attempt [close ccd]
Also refer to "System Port Trap Example" posted by
Carl Sassenrath here on Sun 13/10/2002.
There you can see how to trap the escape and thus be able to
close the port yourself. Check the other posts in the thread
because there are some OS-specific issues there.
Anton.