Messageport single "BYTE" send from AM not working

Discuss suspected bugs with other users and Sim Innovations Staff

Moderators: russ, Ralph

Post Reply
Message
Author
User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Messageport single "BYTE" send from AM not working

#1 Post by jph »

Hi @Corjan
When sending a single "BYTE" from messageport an error is received.

Sending :

Code: Select all

hw_message_port_send(id, 777, "BYTE",55)
gives the following error

Code: Select all

ERROR - logic.lua:17: Expected BYTE type, got number
It 'can' be worked around by doing the following (a bit of a handful for a single byte)

Code: Select all

hw_message_port_send(id,777,"BYTE[0]",{55})

Which gives results of -

Code: Select all

breakdown of what we received follows : 
Message ID = 777
payload->len = 1
payload->type = 0 : which is Byte
we are working with payload->data_byte
payload->data_byte[0] = 55

awaiting next message from air manager : 
Also, when using "BYTE[x]" the 'x' is ignored in the context of -

Code: Select all

hw_message_port_send(id,777,"BYTE[9]",{55})
will give

Code: Select all

breakdown of what we received follows : 
Message ID = 777
payload->len = 1
payload->type = 0 : which is Byte
we are working with payload->data_byte
payload->data_byte[0] = 55
and conversely -

Code: Select all

hw_message_port_send(id, 777, "BYTE[1]", { 0,1, 2, 3,4,5,6,7 } )
will return

Code: Select all

breakdown of what we received follows : 
Message ID = 777
payload->len = 8
payload->type = 0 : which is Byte
we are working with payload->data_byte
payload->data_byte[0] = 0
payload->data_byte[1] = 1
payload->data_byte[2] = 2
payload->data_byte[3] = 3
payload->data_byte[4] = 4
payload->data_byte[5] = 5
payload->data_byte[6] = 6
payload->data_byte[7] = 7

awaiting next message from air manager : 



--------------------------
The following ALL work - for INT, FLOAT and STRING as expected -

an example and results from my diagnostics for a single "INT"

Code: Select all

hw_message_port_send(id, 777, "INT", -450)
from receiving end (in this case a mega)

Code: Select all

breakdown of what we received follows : 
Message ID = 777
payload->len = 1
payload->type = 2 : which is Signed Integer
we are working with payload->data_int
payload->data_int[0] = -450
value in Hexadecimal = FFFFFE3E
value in Binary      = 11111111111111111111111000111110
For a single "FLOAT" it is the same, all good.

regards
Joe
Joe. CISSP, MSc.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Messageport single "BYTE" send from AM not working

#2 Post by jph »

As a follow up,
It would appear that the [x] after the type "INT" "FLOAT" etc seem pretty superfluous ?

The following

Code: Select all

hw_message_port_send(id, 777, "INT", {-450,25,6553})

works perfectly well
However, the curly braces are not needed for a single value as in

Code: Select all

hw_message_port_send(id, 777, "INT",-450)
Which is fine

I also checked with "BYTE" and it can also be made to work for a single value by adding the curly braces (where INT or FLOAT does not need them for a single value)
this works

Code: Select all

hw_message_port_send(id,777,"BYTE",{55})
and also this

Code: Select all

hw_message_port_send(id,777,"BYTE",{55,100,255,5,7})
Regards,
Joe
Joe. CISSP, MSc.

User avatar
Corjan
Posts: 2936
Joined: Thu Nov 19, 2015 9:04 am

Re: Messageport single "BYTE" send from AM not working

#3 Post by Corjan »

Hi,


Yeah, I think the [] part is being ignored.
Might be better to strip that from the API all together,

There is no check comparing both array lenghts.


Corjan

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Messageport single "BYTE" send from AM not working

#4 Post by jph »

Corjan wrote: Sat Sep 03, 2022 7:38 am Hi,


Yeah, I think the [] part is being ignored.
Might be better to strip that from the API all together,

There is no check comparing both array lenghts.


Corjan
Hi Corjan, yes agreed. Let's lose the that completely. We have the array size from payload->len.
It only remains then to decide if a SINGLE value needs curly brackets ?.
at the moment only the BYTE needs the curly brackets on a single value, INT and FLOAT do not.
I think it would be better to only require them for multiple values ?
Thanks
Joe
Joe. CISSP, MSc.

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Messageport single "BYTE" send from AM not working

#5 Post by jph »

On a similar note @Corjan , you may have missed this, but it would be good if you could offer some input ?
this refers to the receiving of multiple values in the payload at the AM end as this is a very strange setup - or, I am doing something completely wrong ? - (but it is all completely undocumented)

If you can please just scan the first 3 or 4 messages and please offer any feedback / comments that would be great.

https://siminnovations.com/forums/viewt ... geport+len

Regards as always,
Joe
Joe. CISSP, MSc.

User avatar
Corjan
Posts: 2936
Joined: Thu Nov 19, 2015 9:04 am

Re: Messageport single "BYTE" send from AM not working

#6 Post by Corjan »

Hi,


I have added this to the TODO.

Will probably have time in about a week from now. Will also respond to the other issue.


Corjan

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Messageport single "BYTE" send from AM not working

#7 Post by jph »

Thank you ever so much, Corjan,
Joe
Joe. CISSP, MSc.

Post Reply