This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

how to decode 4 byte access control
#1
Hi!

I am trying to decode 4 byte access control value. In my project its group address is 13/3/9, data type is "15. 4byte access control".

The following image shows how the ETS group monitor decoded this value. like "11 11 11 40".
     

However, when I log the event.getvalue() in LM event script, as the second image shows the value does not make sense.
   

Is there a way to decode this value inside event script, like the ETS group monitor does ?

Thank you for your help in advance   Smile
Reply
#2
Use this:
Code:
value = event.getvalue()

f0 = bit.band(bit.rshift(value, 28), 0x0F)
f1 = bit.band(bit.rshift(value, 24), 0x0F)
f2 = bit.band(bit.rshift(value, 20), 0x0F)
f3 = bit.band(bit.rshift(value, 16), 0x0F)
f4 = bit.band(bit.rshift(value, 12), 0x0F)
f5 = bit.band(bit.rshift(value, 8), 0x0F)

code = f0 .. f1 .. f2 .. f3 .. f4 .. f5
err = bit.band(value, 0x80) == 0x80
permission = bit.band(value, 0x40) == 0x40
direction = bit.band(value, 0x20) == 0x20
encryption = bit.band(value, 0x10) == 0x10
index = bit.band(value, 0x0F)

log(code, err, permission, direction, encryption, index)
Reply
#3
Dear admin,

Thank you so much for your quick reply!

I just tried the code and it's working perfect Smile

Much appreciated !
Reply


Forum Jump: