Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

Multi-state (Image/state assignments problem)


  • image

    there are 3 bits (*) they change constantly, so they should be ignored. how does it work?
    as a data source I use the http-retriever with regex [(.{ 7})].

    • regex: (..)...(..) does not work

  • I would use a meta point to remove the middle bits. The state list in the above image does not support wildcards.


  • tell me more about meta points.
    where are the meta point settings?


  • The metapoints use other points as inputs. In your case you could use metapoint to take the value an modify it(filter the bits out). Then you could use the metapoint on the view.

    You need to add meta datasource and the metapoints into it.

    BR
    -Jokke


  • there are a metapoint documentation? what's the script langurage?
    how i filter bits?


  • i used this to derive bit status from a word to drive a binary meta point...

    b="1";
    if (word.value & Math.pow(2,b)) value=true;
    else value=false;
    return value;

    b is the bit u want... 0-15
    word is the context variable (i chose to name is word)

    maybe it can point u in the right direction...

    the script language is described in the help.... its ECMAscript i think

    Neil


  • if you create the meta data source there is the symbol with (?).

    Help tells the script is JavaScript / ECMAScript so basicly the same as every where else on mango.

    you could add something like this to the meta point script to mask the bits 2, 3 and 4 out.

    return (p100.value & 0xFFE3);

    replace p100 with the script context var appropriate on your case.

    if you data value is alphanumeric then it maybe a different solution. (and if you want to be able to set the value then there might be needed some point link)

    BR
    -Jokke


  • Note that all the usual bitwise operators work in ECMAScript (and apparently Javascript too). So, you can do stuff like:

    if (word.value & 8) { ... stuff to do when the third bit is on }
    

    ... or:

    if ((word.value &gt&gt 3) & 1) { ... stuff to do when the third bit is on }
    

    If you have a byte value b, and you want to remove bits 4, 5, and 6 (counting from LSB), i.e. xx***xxx, you could do this:

    
    var b = source.value;
    b = (b & 7) | ((b &gt&gt 3) & 24);
    return b;
    
    

    This will leave you with only the other 5 bits, a number from 0 to 31.


  • Jokke beat me to the response.


  • :)

    You took an other cup of coffee while responding. :) Luckily the answers were not same but different aspect on same.

    btw bit offtopic. It has been a while since doing any bit filtering. Happen to know is there any way to represent binary values on JS? (like hex is 0x prefix) atleast 0b is not working. With quick internet search I did not find anything.

    BR
    -Jokke


  • Mmmm, coffee. AFAIK, the '0b' prefix is not supported.


  • thx for much help
    I have another solution, but I do not know if that's possible

    part 1 : .(..) regex
    part 2: .{5}(..) regex

    it is possible to write a row? with script?
    two points (or more) in metadatasource who multiplicated?
    image


  • You can include as many points as you need in a meta point script.


  • and how does it work?
    whats the script term?
    may anyone help me pls :)

    • it must be multistate
    
    var b =  p46.value + p47.value;
    return b;
    

    does not work, because..
    1000 = 10
    0010 = 10
    :/
    mango think the figueres are dezimal not bitwise