Home AMX User Forum AMX General Discussion

Stumped Again?

I've been modifying my send_string 0 handler (debug function) so that it always sends the max possible characters as possible but the same two lines always get truncated when as far as I can tell they shouldn't be with my code as written. I keep looking at it and can't figure out why.

In the below diagnostics print out lines 7 & 8 always get truncated. If I copy line 7 from diagnostics I get a string with a length of 225 which is why it's getting truncated at the 210 char point.

string copied form diagnostics (225 chars):
Line      7 (20:17:47)::  JSON_MOD-[1]:DEBUG:[L-1], RX, DATA.TEXT-[ HTTP/1.1 200 OK$0D$0AServer: Logitech Media Server (7.8.0 - 1392818344)$0D$0AContent-Length: 1324$0D$0AContent-Type: application/json$0D$0AX-Time-To-Serve: 0

what's displayed on diagnostics, lines 7 & 8 get truncated at the 210 char point. Line 1 shows that the string length that my function should be sending has been set to 157, so my string segment of 157 plus my prefix applied of 30 (max) chars and Netlinx's prefix of 26 chars (line # and time::):

Note that printed on the display line 7 stops at the T of X-Time X-T... and line 8 ends at "signast... When copying you can get more than what's actually displayed.
Line      1 (20:17:47)::  JSON_MOD-[1]:DEBUG:[L-0], set debug str length-[ 157 ] :DEBUG<195>
Line      2 (20:17:47)::  JSON_MOD-[1]:DEBUG:[L-1], JSON_MOD-[ 1 ], host IP-[ 192.168.1.47 ], Attempting IP_Open :DEBUG<340>
Line      3 (20:17:47)::  Connected Successfully
Line      4 (20:17:47)::  CIpEvent::OnLine 0:43:1
Line      5 (20:17:47)::  JSON_MOD-[1]:DEBUG:[L-1], ONLINE, IP-[ 192.168.1.47 ], PORT-[ 9000 ] :DEBUG<493>
Line      6 (20:17:47)::  JSON_MOD-[1]:DEBUG:[L-1], TX, METHOD-[ 12 ], STR-[ {"id":1,"method":"slim.request","params":["00:04:20:1a:ea:f6",["status","-",1,"tags:uB"]]} ] :DEBUG<1316>
Line      7 (20:17:47)::  JSON_MOD-[1]:DEBUG:[L-1], RX, DATA.TEXT-[ HTTP/1.1 200 OK$0D$0AServer: Logitech Media Server (7.8.0 - 1392818344)$0D$0AContent-Length: 1324$0D$0AContent-Type: application/json$0D$0AX-Time-To-Serve: 0
Line      8 (20:17:47)::  JSON_MOD-[1]:DEBUG:[L-2], .0387270450592041$0D$0A$0D$0A{"method":"slim.request","result":{"player_name":"Player1","player_connected":1,"player_ip":"127.0.0.1:55346","power":1,"signalstrength"
Line      9 (20:17:47)::  JSON_MOD-[1]:DEBUG:[L-3], :0,"mode":"stop","remote":1,"current_title":"Bruno Mars Radio","time":0,"rate":1,"duration":231.5231875,"mixer volume":100,"playlist repeat":0,"playlist shuf
Line     10 (20:17:47)::  JSON_MOD-[1]:DEBUG:[L-4], fle":1,"playlist mode":"off","seq_no":0,"playlist_cur_index":"0","playlist_timestamp":1395104255.28555,"playlist_tracks":1,"remoteMeta":{"id":"-221455520","t
Line     11 (20:17:47)::  JSON_MOD-[1]:DEBUG:[L-5], itle":"Payphone","url":"pandora://1311850086720882482.mp3","buttons":{"repeat":{"icon":"html/images/btn_thumbs_up.gif","jiveStyle":"thumbsUp","tooltip":"I li
Line     12 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-6], ke this song","command":["pandora","rate","1"]},"fwd":"1","rew":"0","shuffle":{"icon":"html/images/btn_thumbs_down.gif","jiveStyle":"thumbsDown","tooltip":"I
Line     13 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-7],  don't like this song","command":["pandora","rate","0"]}}},"playlist_loop":[{"playlist index":0,"id":"-221455520","title":"Payphone","url":"pandora://1311850
Line     14 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-8], 086720882482.mp3","buttons":{"repeat":{"icon":"html/images/btn_thumbs_up.gif","jiveStyle":"thumbsUp","tooltip":"I like this song","command":["pandora","rate"
Line     15 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-9], ,"1"]},"fwd":"1","rew":"0","shuffle":{"icon":"html/images/btn_thumbs_down.gif","jiveStyle":"thumbsDown","tooltip":"I don't like this song","command":["pandor
Line     16 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-10], a","rate","0"]}}}]},"params":["00:04:20:1a:ea:f6",["status","-","1","tags:uB"]],"id":"1"} ] :DEBUG<1509>
Line     17 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], RX, STRSEG-[ HTTP/1.1 200 OK$0D$0A ] :DEBUG<1516>
Line     18 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], RX, STRSEG-[ Server: Logitech Media Server (7.8.0 - 1392818344)$0D$0A ] :DEBUG<1516>
Line     19 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], RX, STRSEG-[ Content-Length: 1324$0D$0A ] :DEBUG<1516>
Line     20 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], RX, STRSEG-[ Content-Type: application/json$0D$0A ] :DEBUG<1516>
Line     21 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], RX, STRSEG-[ X-Time-To-Serve: 0.0387270450592041$0D$0A ] :DEBUG<1516>
Line     22 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], RX, STRSEG-[ $0D$0A ] :DEBUG<1516>
Line     23 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 11 ], PAIRS-[ 1 ] :DEBUG<272>
Line     24 (20:17:48)::  Memory Available = 190143864 <1820464>
Line     25 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 406 ], PAIRS-[ 2 ] :DEBUG<284>
Line     26 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 496 ], PAIRS-[ 3 ] :DEBUG<284>
Line     27 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 506 ], PAIRS-[ 4 ] :DEBUG<284>
Line     28 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 662 ], PAIRS-[ 5 ] :DEBUG<284>
Line     29 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 817 ], PAIRS-[ 6 ] :DEBUG<284>
Line     30 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 926 ], PAIRS-[ 7 ] :DEBUG<284>

My code that handles sending strings to diagnostics:
DEFINE_FUNCTION fnJSON_DeBug(CHAR iStr[])

     {
     if(nJSON_DeBug[1] > DEBUG_AXI_ONLY)
	  {
	  STACK_VAR CHAR cCopyStr[MAX_RESP_LEN];
	  STACK_VAR INTEGER nLineCount;
	  LOCAL_VAR INTEGER nLenStr;
	  
	  if(!nLenStr)
	       {//CHAR JSON_MAX_DEBUG_STR = 187; //213 is max, 187 is max we can use. 213 - 26 chars used by AMX (26 + 187 =213) 
	       cCopyStr = 'JSON_MOD-[xxx] DEBUG:[L-xxx], ';//max it can realistically ever be
	       nLenStr = (JSON_MAX_DEBUG_STR - LENGTH_STRING(cCopyStr));
	       SEND_STRING 0,"'JSON_MOD-[',itoa(sJSON.sPlayer.nDev_Instance),']:DEBUG:[L-',itoa(nLineCount),'], set debug str length-[ ',itoa(nLenStr),' ] :DEBUG<',ITOA(__LINE__),'>'";
	       cCopyStr = '';
	       }
	       
	  cCopyStr = iStr;
	  WHILE(length_string(cCopyStr) > nLenStr)//master needs 26 chars of the 213 total
	       {
	       nLineCount ++;
	       SEND_STRING 0,"'JSON_MOD-[',itoa(sJSON.sPlayer.nDev_Instance),']:DEBUG:[L-',itoa(nLineCount),'], ',get_buffer_string(cCopyStr,nLenStr)";
	       }
	  if(length_string(cCopyStr))
	       {
	       nLineCount ++;
	       SEND_STRING 0,"'JSON_MOD-[',itoa(sJSON.sPlayer.nDev_Instance),']:DEBUG:[L-',itoa(nLineCount),'], ',cCopyStr";
	       }
	  }
     
     RETURN;
     } 
I don't see what's allowing this function to send the longer strings consistently on these two line and only these two. Maybe $0d,$0a is messing with get_buffer_string function? I can't see why so I'm hoping someone else will.

All other blocks that I've look at seem fine so what's making my function skip a beat on those two lines?:
Line     36 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_TopTags, Index-[ 1 ], Tag-[ method ], Val-[ slim.request ] :DEBUG<903>
Line     37 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_TopTags, Index-[ 2 ], Tag-[ result ], Val-[ {"player_name":"Player1","player_connected":1,"player_ip":"127.0.0.1:55346","power":1,"signalstrength":0,"m
Line     38 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-2], ode":"stop","remote":1,"current_title":"Bruno Mars Radio","time":0,"rate":1,"duration":231.5231875,"mixer volume":100,"playlist repeat":0,"playlist shuffle":
Line     39 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-3], 1,"playlist mode":"off","seq_no":0,"playlist_cur_index":"0","playlist_timestamp":1395104255.28555,"playlist_tracks":1,"remoteMeta":{"id":"-221455520","title"
Line     40 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-4], :"Payphone","url":"pandora://1311850086720882482.mp3","buttons":{"repeat":{"icon":"html/images/btn_thumbs_up.gif","jiveStyle":"thumbsUp","tooltip":"I like th
Line     41 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-5], is song","command":["pandora","rate","1"]},"fwd":"1","rew":"0","shuffle":{"icon":"html/images/btn_thumbs_down.gif","jiveStyle":"thumbsDown","tooltip":"I don'
Line     42 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-6], t like this song","command":["pandora","rate","0"]}}},"playlist_loop":[{"playlist index":0,"id":"-221455520","title":"Payphone","url":"pandora://131185008672
Line     43 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-7], 0882482.mp3","buttons":{"repeat":{"icon":"html/images/btn_thumbs_up.gif","jiveStyle":"thumbsUp","tooltip":"I like this song","command":["pandora","rate","1"]
Line     44 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-8], },"fwd":"1","rew":"0","shuffle":{"icon":"html/images/btn_thumbs_down.gif","jiveStyle":"thumbsDown","tooltip":"I don't like this song","command":["pandora","r
Line     45 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-9], ate","0"]}}}]} ] :DEBUG<903>
Line     46 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 1 ], raw-[ player_name":"Player1 ] :DEBUG<604>
Line     47 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 2 ], raw-[ player_connected":1 ] :DEBUG<604>
Line     48 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 3 ], raw-[ player_ip":"127.0.0.1:55346 ] :DEBUG<604>
Line     49 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 4 ], raw-[ power":1 ] :DEBUG<604>
Line     50 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 5 ], raw-[ signalstrength":0 ] :DEBUG<604>
Line     51 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 6 ], raw-[ mode":"stop ] :DEBUG<604>
Line     52 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 7 ], raw-[ remote":1 ] :DEBUG<604>
Line     53 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 8 ], raw-[ current_title":"Bruno Mars Radio ] :DEBUG<604>
Line     54 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 9 ], raw-[ time":0 ] :DEBUG<604>
Line     55 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 10 ], raw-[ rate":1 ] :DEBUG<604>
Line     56 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 11 ], raw-[ duration":231.5231875 ] :DEBUG<604>
Line     57 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 12 ], raw-[ mixer volume":100 ] :DEBUG<604>
Line     58 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 13 ], raw-[ playlist repeat":0 ] :DEBUG<604>
Line     59 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 14 ], raw-[ playlist shuffle":1 ] :DEBUG<604>
Line     60 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 15 ], raw-[ playlist mode":"off ] :DEBUG<604>
Line     61 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 16 ], raw-[ seq_no":0 ] :DEBUG<604>
Line     62 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 17 ], raw-[ playlist_cur_index":"0 ] :DEBUG<604>
Line     63 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 18 ], raw-[ playlist_timestamp":1395104255.28555 ] :DEBUG<604>
Line     64 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 19 ], raw-[ playlist_tracks":1 ] :DEBUG<604>
Line     65 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 14 ], PAIRS-[ 1 ] :DEBUG<272>
Line     66 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 104 ], PAIRS-[ 2 ] :DEBUG<284>
Line     67 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 114 ], PAIRS-[ 3 ] :DEBUG<284>
Line     68 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 270 ], PAIRS-[ 4 ] :DEBUG<284>
Line     69 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 20 ], raw-[ remoteMeta":{"id":"-221455520","title":"Payphone","url":"pandora://1311850086720882482.mp3","buttons":{"repeat":{"icon":"h
Line     70 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-2], tml/images/btn_thumbs_up.gif","jiveStyle":"thumbsUp","tooltip":"I like this song","command":["pandora","rate","1"]},"fwd":"1","rew":"0","shuffle":{"icon":"ht
Line     71 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-3], ml/images/btn_thumbs_down.gif","jiveStyle":"thumbsDown","tooltip":"I don't like this song","command":["pandora","rate","0"]}}} ] :DEBUG<604>
Line     72 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ [ ], POS-[ 18 ], PAIRS-[ 1 ] :DEBUG<272>
Line     73 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ [ ], POS-[ 240 ], PAIRS-[ 2 ] :DEBUG<284>
Line     74 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ [ ], POS-[ 406 ], PAIRS-[ 3 ] :DEBUG<284>
Line     75 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 21 ], raw-[ playlist_loop":[{"playlist index":0,"id":"-221455520","title":"Payphone","url":"pandora://1311850086720882482.mp3","button
Line     76 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-2], s":{"repeat":{"icon":"html/images/btn_thumbs_up.gif","jiveStyle":"thumbsUp","tooltip":"I like this song","command":["pandora","rate","1"]},"fwd":"1","rew":"0
Line     77 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-3], ","shuffle":{"icon":"html/images/btn_thumbs_down.gif","jiveStyle":"thumbsDown","tooltip":"I don't like this song","command":["pandora","rate","0"]}}}] ] :DEB
Line     78 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-4], UG<604>
Line     79 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, found-[ 21 ], tags :DEBUG<647>
Line     80 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Process_ObjArry, TAG-[ result ], begin processing :DEBUG<953>
Line     81 (20:17:48)::  Memory Available = 189947424 <196440>
Line     82 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Process_ObjArry, TAG-[ playlist_loop ], is Object or Array, send to parser :DEBUG<975>
Line     83 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 1 ], raw-[ playlist index":0 ] :DEBUG<604>
Line     84 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 2 ], raw-[ id":"-221455520 ] :DEBUG<604>
Line     85 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 3 ], raw-[ title":"Payphone ] :DEBUG<604>
Line     86 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 4 ], raw-[ url":"pandora://1311850086720882482.mp3 ] :DEBUG<604>
Line     87 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 12 ], PAIRS-[ 1 ] :DEBUG<272>
Line     88 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 22 ], PAIRS-[ 2 ] :DEBUG<284>
Line     89 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 178 ], PAIRS-[ 3 ] :DEBUG<284>
Line     90 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 5 ], raw-[ buttons":{"repeat":{"icon":"html/images/btn_thumbs_up.gif","jiveStyle":"thumbsUp","tooltip":"I like this song","command":["
Line     91 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-2], pandora","rate","1"]},"fwd":"1","rew":"0","shuffle":{"icon":"html/images/btn_thumbs_down.gif","jiveStyle":"thumbsDown","tooltip":"I don't like this song","co
Line     92 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-3], mmand":["pandora","rate","0"]}} ] :DEBUG<604>
Line     93 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, found-[ 5 ], tags :DEBUG<647>
Line     94 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Process_ObjArry, TAG-[ playlist_loop ], parse complete, send to process :DEBUG<977>
Line     95 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Process_ObjArry, TAG-[ playlist_loop ], begin processing :DEBUG<953>
Line     96 (20:17:48)::  Memory Available = 189750984 <196440>
Line     97 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Process_ObjArry, TAG-[ playlist_loop ], processing complete :DEBUG<979>
Line     98 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Process_ObjArry, TAG-[ remoteMeta ], is Object or Array, send to parser :DEBUG<975>
Line     99 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 1 ], raw-[ id":"-221455520 ] :DEBUG<604>
Line    100 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 2 ], raw-[ title":"Payphone ] :DEBUG<604>
Line    101 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 3 ], raw-[ url":"pandora://1311850086720882482.mp3 ] :DEBUG<604>
Line    102 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 12 ], PAIRS-[ 1 ] :DEBUG<272>
Line    103 (20:17:48)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 22 ], PAIRS-[ 2 ] :DEBUG<284>
Line    104 (20:17:49)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 178 ], PAIRS-[ 3 ] :DEBUG<284>
Line    105 (20:17:49)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, index-[ 4 ], raw-[ buttons":{"repeat":{"icon":"html/images/btn_thumbs_up.gif","jiveStyle":"thumbsUp","tooltip":"I like this song","command":["
Line    106 (20:17:49)::  JSON_MOD-[1]:DEBUG:[L-2], pandora","rate","1"]},"fwd":"1","rew":"0","shuffle":{"icon":"html/images/btn_thumbs_down.gif","jiveStyle":"thumbsDown","tooltip":"I don't like this song","co
Line    107 (20:17:49)::  JSON_MOD-[1]:DEBUG:[L-3], mmand":["pandora","rate","0"]}} ] :DEBUG<604>
Line    108 (20:17:49)::  JSON_MOD-[1]:DEBUG:[L-1], Parse_ObjArry, found-[ 4 ], tags :DEBUG<647>
Line    109 (20:17:49)::  JSON_MOD-[1]:DEBUG:[L-1], Process_ObjArry, TAG-[ remoteMeta ], parse complete, send to process :DEBUG<977>
Line    110 (20:17:49)::  JSON_MOD-[1]:DEBUG:[L-1], Process_ObjArry, TAG-[ remoteMeta ], begin processing :DEBUG<953>
Line    111 (20:17:49)::  JSON_MOD-[1]:DEBUG:[L-1], Process_ObjArry, TAG-[ buttons ], is Object or Array, send to parser :DEBUG<1006>
Line    112 (20:17:49)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 10 ], PAIRS-[ 1 ] :DEBUG<272>

Comments

  • ericmedleyericmedley Posts: 4,177
    What happens if you send the same message to a virtual device instead of zero? Do you get the same truncation in diagnostics?
  • viningvining Posts: 4,368
    Haven't tried. The problem is my function shouldn't be able to send strings long enough to need truncation by Netlinx but thos two lines get trough some how everytime while everything else gets sent properly at the proper lenght set by the function.
  • Joe HebertJoe Hebert Posts: 2,159
    vining wrote: »
    All other blocks that I've look at seem fine so what's making my function skip a beat on those two lines?:

    Hex values $0D and $0A are 1 character each even though 3 characters print for each.

    The data portion of line 7 is 173 characters long which is 16 characters past you limit of 157.

    Those extra 16 printed characters are from the 8 hex values in line 7.

    The same goes for line 8 which has 4 hex values. Those 4 hex values account for the extra 8 characters printed on that line.
  • viningvining Posts: 4,368
    Yes that makes perfect sense but I would have never made that connection between the real value lenght of 0d0a being counted by my function and the added characters netlinx adds for display purposes that netlinx then counts.

    I guess I could count the occurrences of them and amend my string length on a line by line basis and add back overages caused by them to the original string.

    Thanks once again Joe! I had a feeling you'd be the one to answer this riddle.
  • viningvining Posts: 4,368
    After modifying the code to account for the extra characters that netlinx adds for displaying $0d,$0a everything looks good.
    Line      1 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-0], set debug str length-[ 157 ] :DEBUG<195>
    Line      2 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-1], JSON_MOD-[ 1 ], host IP-[ 192.168.1.47 ], Attempting IP_Open :DEBUG<383>
    Line      3 (17:21:51)::  Connected Successfully
    Line      4 (17:21:51)::  CIpEvent::OnLine 0:43:1
    Line      5 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-1], ONLINE, IP-[ 192.168.1.47 ], PORT-[ 9000 ] :DEBUG<536>
    Line      6 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-1], TX, METHOD-[ 12 ], STR-[ {"id":1,"method":"slim.request","params":["00:04:20:1a:ea:f6",["status","-",1,"tags:uB"]]} ] :DEBUG<1359>
    Line      7 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-1], RX, DATA.TEXT-[ HTTP/1.1 200 OK$0D$0AServer: Logitech Media Server (7.8.0 - 1392818344)$0D$0AContent-Length: 1324$0D$0AContent-Type: application/json$0D$0AX-
    Line      8 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-2], Time-To-Serve: 0.0444581508636475$0D$0A$0D$0A{"method":"slim.request","result":{"player_name":"Player1","player_connected":1,"player_ip":"127.0.0.1:55346","p
    Line      9 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-3], ower":1,"signalstrength":0,"mode":"stop","remote":1,"current_title":"Bruno Mars Radio","time":0,"rate":1,"duration":231.5231875,"mixer volume":100,"playlist 
    Line     10 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-4], repeat":0,"playlist shuffle":1,"playlist mode":"off","seq_no":0,"playlist_cur_index":"0","playlist_timestamp":1395104255.28555,"playlist_tracks":1,"remoteMet
    Line     11 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-5], a":{"id":"-221455520","title":"Payphone","url":"pandora://1311850086720882482.mp3","buttons":{"repeat":{"icon":"html/images/btn_thumbs_up.gif","jiveStyle":"t
    Line     12 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-6], humbsUp","tooltip":"I like this song","command":["pandora","rate","1"]},"fwd":"1","rew":"0","shuffle":{"icon":"html/images/btn_thumbs_down.gif","jiveStyle":"
    Line     13 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-7], thumbsDown","tooltip":"I don't like this song","command":["pandora","rate","0"]}}},"playlist_loop":[{"playlist index":0,"id":"-221455520","title":"Payphone",
    Line     14 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-8], "url":"pandora://1311850086720882482.mp3","buttons":{"repeat":{"icon":"html/images/btn_thumbs_up.gif","jiveStyle":"thumbsUp","tooltip":"I like this song","co
    Line     15 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-9], mmand":["pandora","rate","1"]},"fwd":"1","rew":"0","shuffle":{"icon":"html/images/btn_thumbs_down.gif","jiveStyle":"thumbsDown","tooltip":"I don't like this 
    Line     16 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-10], song","command":["pandora","rate","0"]}}}]},"params":["00:04:20:1a:ea:f6",["status","-","1","tags:uB"]],"id":"1"} ] :DEBUG<1552>
    Line     17 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-1], RX, STRSEG-[ HTTP/1.1 200 OK$0D$0A ] :DEBUG<1559>
    Line     18 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-1], RX, STRSEG-[ Server: Logitech Media Server (7.8.0 - 1392818344)$0D$0A ] :DEBUG<1559>
    Line     19 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-1], RX, STRSEG-[ Content-Length: 1324$0D$0A ] :DEBUG<1559>
    Line     20 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-1], RX, STRSEG-[ Content-Type: application/json$0D$0A ] :DEBUG<1559>
    Line     21 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-1], RX, STRSEG-[ X-Time-To-Serve: 0.0444581508636475$0D$0A ] :DEBUG<1559>
    Line     22 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-1], RX, STRSEG-[ $0D$0A ] :DEBUG<1559>
    Line     23 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 11 ], PAIRS-[ 1 ] :DEBUG<289>
    Line     24 (17:21:51)::  Memory Available = 190096664 <1820464>
    Line     25 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 406 ], PAIRS-[ 2 ] :DEBUG<301>
    Line     26 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 496 ], PAIRS-[ 3 ] :DEBUG<301>
    Line     27 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 506 ], PAIRS-[ 4 ] :DEBUG<301>
    Line     28 (17:21:51)::  JSON_MOD-[1]:DEBUG:[L-1], FindEndTag, TAG-[ { ], POS-[ 662 ], PAIRS-[ 5 ] :DEBUG<301>
    
    I created a new function to find occurrences of chars and then modified my debug function to change my line lengths when these extra chars that netlinx adds occur:
    DEFINE_FUNCTION INTEGER fnJSON_FindCharOccurrences(CHAR iChars[],CHAR iStr[])
    
         {//pass in a string/array of all the chars you want counted
         STACK_VAR INTEGER nLenS;
         STACK_VAR INTEGER nLenC;
         STACK_VAR INTEGER nCnt;
         STACK_VAR INTEGER i;
         STACK_VAR INTEGER n;
        
         nLenS = LENGTH_ARRAY(iStr);
         nLenC = LENGTH_ARRAY(iChars);
         for(i = nLenS; i; i--)
    	  {
    	  for(n = nLenC; n; n--)
    	       {
    	       if(iStr[i] == iChars[n])
    		    {
    		    nCnt++;
    		    }
    	       }
    	       
    	  }
    
         RETURN nCnt;
         }
    
    DEFINE_FUNCTION fnJSON_DeBug(CHAR iStr[])
    
         {
         if(nJSON_DeBug[1] > DEBUG_AXI_ONLY)
    	  {
    	  STACK_VAR CHAR cCopyStr[MAX_RESP_LEN];
    	  STACK_VAR INTEGER nLineCount;
    	  LOCAL_VAR INTEGER nLenStr;
    	  
    	  if(!nLenStr)
    	       {//CHAR JSON_MAX_DEBUG_STR = 187; //213 is max, 187 is max we can use. 213 - 26 chars used by AMX (26 + 187 =213) 
    	       cCopyStr = 'JSON_MOD-[xxx] DEBUG:[L-xxx], ';//max it can realistically ever be
    	       nLenStr = (JSON_MAX_DEBUG_STR - LENGTH_STRING(cCopyStr));
    	       SEND_STRING 0,"'JSON_MOD-[',itoa(sJSON.sPlayer.nDev_Instance),']:DEBUG:[L-',itoa(nLineCount),'], set debug str length-[ ',itoa(nLenStr),' ] :DEBUG<',ITOA(__LINE__),'>'";
    	       cCopyStr = '';
    	       }
    	       
    	  cCopyStr = iStr;//preserve original
    	  WHILE(length_string(cCopyStr) > nLenStr)
    	       {
    	       STACK_VAR CHAR cStrTmp[MAX_256];
    	       STACK_VAR INTEGER nCnt;
    	       STACK_VAR INTEGER i;
    	       
    	       cStrTmp = get_buffer_string(cCopyStr,nLenStr);
    	       nCnt = fnJSON_FindCharOccurrences("$0d,$0a",cStrTmp);
    	      
    	       nLineCount++;
    	       SEND_STRING 0,"'JSON_MOD-[',itoa(sJSON.sPlayer.nDev_Instance),']:DEBUG:[L-',itoa(nLineCount),'], ',get_buffer_string(cStrTmp,nLenStr - (nCnt*2))";
    	       cCopyStr = "cStrTmp,cCopyStr";
    	       }
    	  if(length_string(cCopyStr))
    	       {
    	       STACK_VAR INTEGER nCnt;
    	       
    	       nCnt = fnJSON_FindCharOccurrences("$0d,$0a",cCopyStr);
    		    
    	       nLineCount++;
    	       if((LENGTH_STRING(cCopyStr) + (nCnt*2)) > nLenStr)
    		    {
    		    SEND_STRING 0,"'JSON_MOD-[',itoa(sJSON.sPlayer.nDev_Instance),']:DEBUG:[L-',itoa(nLineCount),'], ',get_buffer_string(cCopyStr,nLenStr - (nCnt*2))";
    		    nLineCount++;
    		    }
    	       SEND_STRING 0,"'JSON_MOD-[',itoa(sJSON.sPlayer.nDev_Instance),']:DEBUG:[L-',itoa(nLineCount),'], ',cCopyStr";
    	       }
    	  }
         
         RETURN;
         } 
    
  • a_riot42a_riot42 Posts: 1,624
    vining wrote: »
    DEFINE_FUNCTION INTEGER fnJSON_FindCharOccurrences(CHAR iChars[],CHAR iStr[])
    
         {//pass in a string/array of all the chars you want counted
         STACK_VAR INTEGER nLenS;
         STACK_VAR INTEGER nLenC;
         STACK_VAR INTEGER nCnt;
         STACK_VAR INTEGER i;
         STACK_VAR INTEGER n;
        
         nLenS = LENGTH_ARRAY(iStr);
         nLenC = LENGTH_ARRAY(iChars);
         for(i = nLenS; i; i--)
    	  {
    	  for(n = nLenC; n; n--)
    	       {
    	       if(iStr[i] == iChars[n])
    		    {
    		    nCnt++;
    		    }
    	       }
    	       
    	  }
    
         RETURN nCnt;
         }
    
    DEFINE_FUNCTION fnJSON_DeBug(CHAR iStr[])
    
         {
         if(nJSON_DeBug[1] > DEBUG_AXI_ONLY)
    	  {
    	  STACK_VAR CHAR cCopyStr[MAX_RESP_LEN];
    	  STACK_VAR INTEGER nLineCount;
    	  LOCAL_VAR INTEGER nLenStr;
    	  
    	  if(!nLenStr)
    	       {//CHAR JSON_MAX_DEBUG_STR = 187; //213 is max, 187 is max we can use. 213 - 26 chars used by AMX (26 + 187 =213) 
    	       cCopyStr = 'JSON_MOD-[xxx] DEBUG:[L-xxx], ';//max it can realistically ever be
    	       nLenStr = (JSON_MAX_DEBUG_STR - LENGTH_STRING(cCopyStr));
    	       SEND_STRING 0,"'JSON_MOD-[',itoa(sJSON.sPlayer.nDev_Instance),']:DEBUG:[L-',itoa(nLineCount),'], set debug str length-[ ',itoa(nLenStr),' ] :DEBUG<',ITOA(__LINE__),'>'";
    	       cCopyStr = '';
    	       }
    	       
    	  cCopyStr = iStr;//preserve original
    	  WHILE(length_string(cCopyStr) > nLenStr)
    	       {
    	       STACK_VAR CHAR cStrTmp[MAX_256];
    	       STACK_VAR INTEGER nCnt;
    	       STACK_VAR INTEGER i;
    	       
    	       cStrTmp = get_buffer_string(cCopyStr,nLenStr);
    	       nCnt = fnJSON_FindCharOccurrences("$0d,$0a",cStrTmp);
    	      
    	       nLineCount++;
    	       SEND_STRING 0,"'JSON_MOD-[',itoa(sJSON.sPlayer.nDev_Instance),']:DEBUG:[L-',itoa(nLineCount),'], ',get_buffer_string(cStrTmp,nLenStr - (nCnt*2))";
    	       cCopyStr = "cStrTmp,cCopyStr";
    	       }
    	  if(length_string(cCopyStr))
    	       {
    	       STACK_VAR INTEGER nCnt;
    	       
    	       nCnt = fnJSON_FindCharOccurrences("$0d,$0a",cCopyStr);
    		    
    	       nLineCount++;
    	       if((LENGTH_STRING(cCopyStr) + (nCnt*2)) > nLenStr)
    		    {
    		    SEND_STRING 0,"'JSON_MOD-[',itoa(sJSON.sPlayer.nDev_Instance),']:DEBUG:[L-',itoa(nLineCount),'], ',get_buffer_string(cCopyStr,nLenStr - (nCnt*2))";
    		    nLineCount++;
    		    }
    	       SEND_STRING 0,"'JSON_MOD-[',itoa(sJSON.sPlayer.nDev_Instance),']:DEBUG:[L-',itoa(nLineCount),'], ',cCopyStr";
    	       }
    	  }
         
         RETURN;
         } 
    

    That's an awful lot of processing for printing debug strings to the console. You've got a nested for loop running O(n²) there. Wouldn't using find_string be more efficient?

    I have a function that prints to the console, but I only print 80 chars at a time. Very simple, very little processing, and I never have issues like you are seeing with truncation. Since its always 80 chars it forms a nice justified text block that is easily copied and pasted if I need to do more processing for examination.
    Paul
  • Joe HebertJoe Hebert Posts: 2,159
    vining wrote: »
    I created a new function to find occurrences of chars and then modified my debug function to change my line lengths when these extra chars that netlinx adds occur:
    DEFINE_FUNCTION INTEGER fnJSON_FindCharOccurrences(CHAR iChars[],CHAR iStr[])
    
         {//pass in a string/array of all the chars you want counted
         STACK_VAR INTEGER nLenS;
         STACK_VAR INTEGER nLenC;
         STACK_VAR INTEGER nCnt;
         STACK_VAR INTEGER i;
         STACK_VAR INTEGER n;
        
         nLenS = LENGTH_ARRAY(iStr);
         nLenC = LENGTH_ARRAY(iChars);
         for(i = nLenS; i; i--)
    	  {
    	  for(n = nLenC; n; n--)
    	       {
    	       if(iStr[i] == iChars[n])
    		    {
    		    nCnt++;
    		    }
    	       }
    	       
    	  }
    
         RETURN nCnt;
         }
    
    

    As a suggestion you can bypass the nested FOR loop and you can eliminate passing in specific characters to search for. Loop thru each byte in iStr and nCnt++ every time a byte is less than $20 or greater than $7E since those are the values that will print 3 characters to the screen.
  • viningvining Posts: 4,368
    Joe,

    Yeah makes sense, I didn't give it much time this morning and basically just through it together in about 15 minutes prior to heading out to a job site. I was planning on dealing with the other non printing chars when I got back to the office. There's a chance I might I have come to that conclusion too but I might just as easily made the string of chars to count longer.

    a_riot42,

    I agree it's allot of processing and I too original was just grabbing 100 chars since that was a safe number with plenty of extra room and why I never observed this before. However in large returns like the ones I posted I was getting allot of lines and not fully utilizing the length available so I figured WFT why not have some fun and max it out.

    I did think about the overhead but figured it's only on when debugging for this device is on so it isn't really not a big and does make developing a little cleaner with allot less scrolling. I can't use find string since I need to check each char at a time since they could be split when I grab my initial segment and now if I implement Joe's suggestion it' more simplified and easier on the processor.

    In comparison to find_string though I think there is no real difference since find string should work similar (processor intense wise) to my function. If I we're to try and recreate find_string this is how I would go about it. FYI, this is untested and I have no idea if it will actually work but I envision find_string looking something like:
    DEFINE_FUNCTION INTEGER fnFindString(CHAR iStr[],CHAR iFindStr[],INTEGER iStartPoint)
    
         {
         STACK_VAR INTEGER nLenS;
         STACK_VAR INTEGER nLenF;
         STACK_VAR INTEGER nFBS1;
         STACK_VAR INTEGER nFBS2;
         
         nLenS = length_string(iStr);
         nLenF = length_string(iFindStr);
         
         if(!iStartPoint)
    	  {
    	  iStartPoint = 1;
    	  }
         
         for(nFBS1 = iStartPoint; nFBS1 <= nLenS; nFBS1++)
    	  {
    	  for(nFBS2 = 1; nFBS2 <= nLenF; nFBS2++)
    	       {
    	       if(iStr[nFBS1] != iFindStr[nFBS2])
    		    {
    		    BREAK;
    		    }
    	       else if(nFBS2 == nLenF)
    		    {
    		    nFBS2--;
    		    RETURN (nFBS1 - nFBS2);
    		    }
    	       else
    		    {
    		    nFBS1++;
    		    BREAK;
    		    }
    	       }
    	  }
         RETURN 0;
         }
    
    It looks like it might work but I'm too tired to test it.
  • a_riot42a_riot42 Posts: 1,624
    I would guess the find_string function can make use of pointers, making comparisons a bit faster, and deals with trivial cases, but there is no getting around a character by character comparison. The C function strcmp uses a while loop I believe, incrementing the pointer each time, until it no longer matches.

    If you want to have longer lines, you can write to a file instead of the console, and then view it or put it on a web site for viewing in any format you want, or send it back to your machine in real time, etc. Given the amount of debug information you are creating, I can't imagine trying to watch all that go by in the console window is that easy to do, so why not save it for analysis? I nearly always do a copy paste from the console window to notepad anyway, since I can't see that well on a high resolution screen. I have a lot debug information printed, too much to watch as it goes by, but once in a file I can scan it quickly for issues in a larger more readable font. Almost nothing occurs in my programs without printing something so the debug function needs to be lightweight.
    Paul
  • viningvining Posts: 4,368
    I also copy and save to notepad++ to analyze and especially with these JSON returns I put them in a code format based on their braces to help figure out how to deal with parsing it. That said I still like to look at my diagnostics and see the stages as I feel appropriate and I was hesitant about adding the overhead but it does make viewing better. Only certain devs would ever benefit from longer strings so for most I'll stick with my normal 100 char strings.

    FYI I decided to test the find_string function I wrote yesterday and it didn't work, I had a break where I shouldn't have but this version w/o the misplaced break seems to work fine. At least after one test. :) I'd be interested to see a comparison between the version I wrote here and netlinx after x amount of iterations just to see if netlinx's version is faster.
    DEFINE_FUNCTION INTEGER fnFindString(CHAR iStr[],CHAR iFindStr[],INTEGER iStartPoint)
    
         {
         STACK_VAR INTEGER nLenS;
         STACK_VAR INTEGER nLenF;
         STACK_VAR INTEGER nFBS1;
         STACK_VAR INTEGER nFBS2;
         
         nLenS = length_string(iStr);
         nLenF = length_string(iFindStr);
         
         if(!iStartPoint)
    	  {
    	  iStartPoint = 1;
    	  }
         
         for(nFBS1 = iStartPoint; nFBS1 <= nLenS; nFBS1++)
    	  {
    	  for(nFBS2 = 1; nFBS2 <= nLenF; nFBS2++)
    	       {
    	       if(iStr[nFBS1] != iFindStr[nFBS2])
    		    {
    		    BREAK;
    		    }
    	       else if(nFBS2 == nLenF)
    		    {
    		    nFBS2--;
    		    RETURN (nFBS1 - nFBS2);
    		    }
    	       else
    		    {
    		    nFBS1++;
    		    }
    	       }
    	  }
         RETURN 0;
         }
    
  • viningvining Posts: 4,368
    Out of curiosity and boredom I decided to compare the home brewed fnFindString() I posted earlier with the Netlinx function Find_String() and there's a significant difference in the time it takes to complete a 1000 finds.

    Test:
     CASE 5:
    			 {
    			 SET_TIMER('00:00:00');
    			 fnJSON_DeBug("'Test find_string, set_timer-[ 0 ] :DEBUG<',ITOA(__LINE__),'>'");
    			 for(nZ = 1000; nZ; nZ--)
    			      {
    			      if(Find_String(cJSON_TestStr,'method',1))
    				   {
    				   cJSON_TestStr = "'x',cJSON_TestStr";
    				   }
    			      else
    				   {
    				   cJSON_TestStr = "'0',cJSON_TestStr";
    				   }
    			      }
    			 fnJSON_DeBug("'Test find_string, get_timer-[ ',itoa(GET_TIMER),' ] :DEBUG<',ITOA(__LINE__),'>'");
    			 //cJSON_TestStr = '{"id":1,"method":"slim.request","params":["00:04:20:1a:ea:f6",["status","-",1,"tags:uB"]]}';
    			 }
    		    CASE 6:
    			 {
    			 SET_TIMER('00:00:00');
    			 fnJSON_DeBug("'Test fnFindString, set_timer-[ 0 ] :DEBUG<',ITOA(__LINE__),'>'");
    			 for(nZ = 1000; nZ; nZ--)
    			      {
    			      if(fnFindString(cJSON_TestStr,'method',1))
    				   {
    				   cJSON_TestStr = "'x',cJSON_TestStr";
    				   }
    			      else
    				   {
    				   cJSON_TestStr = "'0',cJSON_TestStr";
    				   }
    			      }
    			 fnJSON_DeBug("'Test fnFindString, get_timer-[ ',itoa(GET_TIMER),' ] :DEBUG<',ITOA(__LINE__),'>'");
    			 //cJSON_TestStr = '{"id":1,"method":"slim.request","params":["00:04:20:1a:ea:f6",["status","-",1,"tags:uB"]]}';
    			 }
    
    string:
    cJSON_TestStr = '{"id":1,"method":"slim.request","params":["00:04:20:1a:ea:f6",["status","-",1,"tags:uB"]]}';
    
    Netlinx's Find_String() results:
    Line      5 (17:05:39)::  JSON_MOD-[1]:DEBUG:[L-1], Test find_string, set_timer-[ 0 ] :DEBUG<1782>
    Line      6 (17:05:39)::  JSON_MOD-[1]:DEBUG:[L-1], Test find_string, get_timer-[ 49 ] :DEBUG<1794>
    
    debug cJSON_TestStr = 
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx{"id":1,"method":"slim.request","params":["00:04:20:1a:ea:f6",["status","-",1,"tags:uB"]]}
    
    my function fnFindString() results:
    Line      3 (17:12:23)::  JSON_MOD-[1]:DEBUG:[L-1], Test fnFindString, set_timer-[ 0 ] :DEBUG<1800>
    Line      4 (17:12:45)::  JSON_MOD-[1]:DEBUG:[L-1], Test fnFindString, get_timer-[ 269 ] :DEBUG<1812>
    
    debug cJSON_TestStr = 
    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx{"id":1,"method":"slim.request","params":["00:04:20:1a:ea:f6",["status","-",1,"tags:uB"]]}
    
    so to find a string using the netlinx function for 1000 iterations on a string which adds a char to the beginning every iteration takes 4.9 seconds while my function takes 26.9 seconds. Pretty big difference!
Sign In or Register to comment.