Note that there are some explanatory texts on larger screens.

plurals
  1. POCheck for a especific value inside a string
    primarykey
    data
    text
    <p><strong>UPDATED</strong></p> <p>In my app, I have a continuos communication with a PCB via bluetooth. This communication is made by HEX Strings.</p> <p>The string format is like this:</p> <pre><code>2b(thread init), 05(write command), 09(bytes), 04(variable bytes), 5af2ff1f(memory location), 04a0bcf1(variable value), 7e(checksum) </code></pre> <p>The function of this Hex string is to access to a concrete memory location of the PCB and write a value.</p> <p>To do it easier, lets suppouse that the Hex string is:</p> <pre><code>hex_string= 2B05A82BF1 </code></pre> <p>This string, before sending it via bluetooth, I convert it to a Byte[]. What I need is to create a function that checks all the strings I send. </p> <p>What I must look for, is for any "2B" byte inside the string. This is because the PCB reads the "2b" as a "init thread" value and if there is any "2b" inside the string, the PCB would read it as the init of another thread and the string wouldn't be sent entirely.</p> <p>I don't know if is easier to check this with the Hex String, or after converting it to Byte[].</p> <p>The function would be to disscard the first "2b" of the string and check if there is another "2b" inside the string, and if it is, duplicate it, resulting this.</p> <pre><code>before: hex_string= 2B05A82BF1 after: hex_string= 2B05A82B2BF1 </code></pre> <p>This way the PCB understands that that "2b" is not a init thread value.</p> <p>What I want to do is a function that checks all string for containing "2b" value inside of it. But i don't know if it's better to do this with the Hex string, when converted to byte[]... or when... and how to do it. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload