Home AMX User Forum AMX Technical Discussion

off line event

Dear all,
Here I am had a problem with an off line event.
I am controlling a winamp Player from a NI3000 . When I close the player from the system. My off line event is detecting it. But if I remove the network cable from the computer or shut down the system. My off line event for the player is not detecting.
Who to fix this?
The code is as flows
DEFINE_DEVICE
WINAMP = 0:3:0


DATA_EVENT[WINAMP]
{
ONLINE:
{
SEND_STRING 0, 'WINAMP ON LINE'
WINAMP_STAT = 1
CANCEL_WAIT 'ON_LINE_WAIT'
}
OFFLINE:
{
SEND_STRING 0, 'WINAMP OFF LINE'
WINAMP_STAT = 0
}
}





DEFINE_PROGRAM


IF(WINAMP_STAT = 0)
{
WAIT 100 'ON_LINE_WAIT'
{
IP_CLIENT_CLOSE(WINAMP.PORT)
WAIT 5
IP_CLIENT_OPEN(WINAMP.PORT,'10.1.4.7',3200,1)
SEND_COMMAND TP1,'ABEEP'
}
}

Comments

  • DHawthorneDHawthorne Posts: 4,584
    The system needs some way of determining it went off line. When you close it, it is sending the message out "I am shutting down," so you get an offline event. When you unplug it, no message goes out (and how could it, it's unplugged!). If the device itself does not periodically check in and broadcast it's on the network, it has to be polled periodically. Most network devices broadcast some kind of "I'm still here" message, which is why sometimes a device can go down, and you don't get the offline event until a minute or two later ... it took that long for the system to realize the messages stopped. If no provision is made in the hardware on the network for this, your only choice is to poll it yourself and close the connection if there is no response, forcing the event.
  • BinuBinu Posts: 49
    off line event

    I understand the reson from your replay, Thank you Dave.
Sign In or Register to comment.