Strange codes in MESH SDK

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
4 posts / 0 new
Last post
火鸟
Offline
Last seen:1 month 9 hours ago
加入:2019-07-12 09:48
Strange codes in MESH SDK

Hi, teams.

I am analyzing MESH SDK codes, and build my own MESH application on SDK base.

There are very strange implementations in several models.

For example, in Generic Level Server Model, STATUS message is sent to client by the following code.

return MS_access_publish(&model->model_handle, MS_ACCESS_GENERIC_LEVEL_STATUS_OPCODE, (UCHAR *)&status, sizeof(MS_GENERIC_LEVEL_STATUS_STRUCT) - 1, MS_TRUE);

1. Why sending total structure size minus one bytes should be sent?

2. According to MESH specification, STATUS message should be 3 or 5 byte long.

But in SDK, there is no optional field handling, and even MS_GENERIC_LEVEL_STATUS_STRUCT is not packed!!!

我发现类似的公司des all around models in SDK.

All this codes means SDK is buggy or immature, or some strange magic in MESH binary libraries?

Device:
LC_Dialog
Offline
Last seen:1 month 2 days ago
工作人员
加入:2016-09-19 23:20
Hi firebird,

Hi firebird,

Thanks for sharing the feedback. I am checking on this with our internal team if we carry documentation that will help you get through these issues. Will let you know as soon as I hear back from the team.

Best regards,
LC_Dialog

火鸟
Offline
Last seen:1 month 9 hours ago
加入:2019-07-12 09:48
I've carefully reviewed SDK

I've carefully reviewed SDK codes again to debug myself, and I realized the "length minus one" is the trick for excludingoptional_fields_presentfield.

So, still lack of handling optional field, but it may work.

Sorry for my misunderstanding, but still I am strongly suspicious about message structures are not packed.

Do mesh devices function as spec-compliant? inter-operable?

LC_Dialog
Offline
Last seen:1 month 2 days ago
工作人员
加入:2016-09-19 23:20
Hi firebird,

Hi firebird,

The implementation does not support optional field handling thats why the "minus one bytes" is present. We understand this is not the cleanest way of handling it.

Dialog implementation is spec compliant and has passed Bluetooth SIG qualification for all the supported profiles in Mesh v1.0 spec (declaration ID: D047269 QDID: 114914)

In case you see any bugs or iteropability issues please feel free to report them and we will do everything we can to fix them ASAP.

Best regards,
LC_Dialog