Home AMX User Forum NetLinx Studio

Any ideas on what im doing wrong

I'm trying to extract the sirius station name, channel, artist, and song from line 196. I dont know how to extract because the text seems to change in length when you change channels.
Can anyone guide me in the right direction.




I've copied the incoming string from port 2 on an ni4100 to a text file so everyone can see
Seems like line 196 is where my info resides and repeats on 205



Line 194 (16:03:50):: String From [5001:2:1]-[U$15'$00TUNER 1 98.7 MHz$00kU$08)$00$00Fb$00$D2]

Line 195 (16:03:50):: String From [5001:2:1]-[U$16'$01TUNER 2 106.3 MHz$00FU$08)$01$00$1Ej$00$F1U$1B'$02Sirius/XM: Raw Dog 104$00$A1]

Line 196 (16:03:50):: String From [5001:2:1]-[UA$93$91 $00$00$01$00$01$00$00$00$00$00$00$00$00$00$00$00$00$00$00$00$00Comedy$00Raw Dog 104$00Earthquake$00Clintons]

Line 197 (16:03:50):: String From [5001:2:1]-[$00U]

Line 198 (16:03:50):: String From [5001:2:1]-[U$0B'$03IPOD 1$00$F9]

Line 199 (16:03:50):: String From [5001:2:1]-[U$0B $00$00$00$FF$16$06$0C4%U$0B $01$00$00$FF$14$0A$086$U$0B $02$00$00$FF$19$06$080(U$0B $03$00$00$FF$16$0C$0A4$1EU$0B $04$00$00$FF$18$04$0A2%U$0B $05]

Line 200 (16:03:51):: String From [5001:2:1]-[$00$00$FF$13$00$0081U$0B $06$00$00$FF8$04$08$1B$1CU$0B $07$00$02$02 $06$0A*$1B]

Line 201 (16:03:51):: String From [5001:2:1]-[U$0B $08$00$00$FF$16$0A$084$1DU$0B $09$00$00$FF$13$04$048%U$0B $0A$00$00$FF$11$00$00:,U$0B $0B$00$00$FF$16$04$044$U$0B $0C$00$00$FF$16$04$044#U$0B $0D]

Line 202 (16:03:51):: String From [5001:2:1]-[$00$00$FF$16$F8$064,U$0B $0E$00$00$FF$16$00$004)U$0B $0F$00$00$FFH$00$00$11$19]

Line 203 (16:03:53):: String From [5001:2:1]-[U$15'$00TUNER 1 98.7 MHz$00kU$08)$00$00Fb$00$D2]

Line 204 (16:03:53):: String From [5001:2:1]-[U$16'$01TUNER 2 106.3 MHz$00FU$08)$01$00$1Ej$00$F1U$1B'$02Sirius/XM: Raw Dog 104$00$A1]

Line 205 (16:03:53):: String From [5001:2:1]-[UA$93$91 $00$00$01$00$01$00$00$00$00$00$00$00$00$00$00$00$00$00$00$00$00Comedy$00Raw Dog 104$00Earthquake$00Clintons]



DATA_EVENT [dvMZC88]
{
ONLINE:
{
SEND_COMMAND dvMZC88, "'SET BAUD 57600,N,8,1'"
SEND_COMMAND dvMZC88, 'HSOFF'
SEND_COMMAND dvMZC88, 'XOFF'
SEND_COMMAND dvMZC88, 'CHARD-0'
}
STRING:
{
LOCAL_VAR CHAR cTRASH[100], cMZC88_BUFFER[200], cGENRE_BUFFER[200],cTEST_1[20],cTEST_2[20],cTEST[20]
cMZC88=DATA.TEXT
SELECT
{
ACTIVE (FIND_STRING(cMZC88,'TUNER 1 ',1)): // Tuner 1 station (works fine)
{
cTRASH=REMOVE_STRING(cMZC88,'TUNER 1 ',1)
cMZC88_TUNER1=REMOVE_STRING(cMZC88,'Hz',1)
send_command dTp[1], "'^BMF-1,0,%T',cMZC88_TUNER1"
send_command dTp[2], "'^BMF-1,0,%T',cMZC88_TUNER1"
cTEST_1='TUNER 1' ///////////////////// Test variable .... using debug i can see that this active works
}
ACTIVE (FIND_STRING(cMZC88,'TUNER 2 ',1)): // Tuner 2 station (works fine)
{
cTRASH=REMOVE_STRING(cMZC88,'TUNER 2 ',1)
cMZC88_TUNER2=REMOVE_STRING(cMZC88,'Hz',1)
send_command dTp[1], "'^BMF-2,0,%T',cMZC88_TUNER2"
send_command dTp[2], "'^BMF-2,0,%T',cMZC88_TUNER2"
cTEST_2='TUNER 2' ///////////////////// Test variable.... using debug i can see that this active works
}
ACTIVE (FIND_STRING(cMZC88,'$93$91',1)): /// trying to find this instance that occurs often
{
cMZC88_BUFFER=REMOVE_STRING(cMZC88,'$0B',1) /// remove everything up to the beginning of the ipod string
cTEST='IM ACTIVE' ///////////////////// Test variable.....using debug it seems this active doesnt work
}

}
}

}

Comments

  • Spire_JeffSpire_Jeff Posts: 1,917
    ACTIVE (FIND_STRING(cMZC88,"$93,$91",1)):

    Try that active statement.

    You will also need to modify your parsing routine to remove the leading "$00" and "$01", but then you can use "$00" as a delimiter to extract the category, channel name and other stuff. (At least it seems that way).



    Jeff
  • GfullGfull Posts: 19
    thanks jeff will try tommorrow
  • GfullGfull Posts: 19
    That worked

    thanks Spire_Jeff
Sign In or Register to comment.