Home AMX User Forum NetLinx Studio

Document Camera Feedback

I'm working with document camera feedback to show the power status in case someone turns it on or off without using the control panel. The problem is that the response has a space in it.
Can I put a space in find_string(data.text," ") OR can I put an ELSE statement in STRING / DATA_EVENT??

When power is on I get $B0a$80$02$00$BF
When power is off I get $B0a$80 $00$BF

This works if it is turned on from the camera.

DATA_EVENT [dvDocCam]
{
STRING:
IF(LENGTH_STRING(data.text))
{
SELECT
{
ACTIVE (FIND_STRING(data.text,"$80,$02",1)):
nDocPwr = DPWRON
}
}
}

Can I put a space in there data.text,"$80, ",1)):

I tried to put an ELSE statement in there (IF it's not ON then it must be OFF) but that didn't work.

Comments

  • JasonSJasonS Posts: 229
    You need to put your space in single quotes "$80, ' '", or use $20 (hex value of a space)
  • That's probably just an annoying feature of the NetLinx Studio noftication/diagnostics. It replaces a number that within the range of ASCII codes with that ASCII symbol. Just as the letter 'a' in your response is $61, the space is just $20. So:
    Power on response : $B0$61$80$02$00$BF
    Power off response : $B0$61$80$20$00$BF

    Richard
  • TUTechTUTech Posts: 70
    Thanks for your help. I'll give it a try tomorrow.
    Sorry for the double post!
    David
  • ericmedleyericmedley Posts: 4,177
    you don't use " for text. you use a single quote '

    so your conditional would look like

    FIND_STRING (data.text,' ',1)
  • TUTechTUTech Posts: 70
    ericmedley wrote: »
    you don't use " for text. you use a single quote '

    so your conditional would look like

    FIND_STRING (data.text,' ',1)

    This is what I used and it works perfect!

    DATA_EVENT [dvDocCam]
    {
    STRING:
    IF(LENGTH_STRING(data.text))
    {
    SELECT
    {
    ACTIVE (FIND_STRING(data.text,"$80,$02",1)):
    nDocPwr = DPWRON

    ACTIVE (FIND_STRING(data.text,"$80,$20",1)):
    nDocPwr = DPWROFF
    }

    }
  • ericmedleyericmedley Posts: 4,177
    TUTech wrote: »

    This is what I used and it works perfect!

    DATA_EVENT [dvDocCam]
    {
    STRING:
    IF(LENGTH_STRING(data.text))
    {
    SELECT
    {
    ACTIVE (FIND_STRING(data.text,"$80,$02",1)):
    nDocPwr = DPWRON

    ACTIVE (FIND_STRING(data.text,"$80,$20",1)):
    nDocPwr = DPWROFF
    }

    }

    That's good! I'm glad it works. And just for future reference. "$20" and ' ' ('<space bar>') are the same thing.
  • TUTechTUTech Posts: 70
    Oh, OK. I understand what you meant now. The space goes in between single quotes not the whole feedback string.

    I found another part of the program where I got '@' as feedback. I replaced it with the correct hex value and it worked.

    Thanks again.
Sign In or Register to comment.