IoTMadeEasy component : "Client Identifier" field supports only 20 characters

For general Flowcode discussion that does not belong in the other sections.
Post Reply
miggarc
Posts: 52
http://meble-kuchenne.info.pl
Joined: Mon Jan 04, 2021 8:08 pm
Has thanked: 7 times
Been thanked: 4 times

IoTMadeEasy component : "Client Identifier" field supports only 20 characters

Post by miggarc »

Hi…

My unique identifier key with “IoT mqtt borker service” I use ( Adafruit IO ) is longer
than the IoTMadeEasy Component seams to support on its “Client Identifier” field .

On mouse over “Client Identifier” field, on IoTMadeEasy Component properties, it is said 20 characters maximum.

My unique identifier key is 32 characters long.


How to solve this ???

Any ideas ???

Many thanks in advance,


Miguel Garcia,
Electronic Systems Developer

mnfisher
Valued Contributor
Posts: 938
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 502 times

Re: IoTMadeEasy component : "Client Identifier" field supports only 20 characters

Post by mnfisher »

Try it - looks like it might just be an error in the property description....

Martin

miggarc
Posts: 52
Joined: Mon Jan 04, 2021 8:08 pm
Has thanked: 7 times
Been thanked: 4 times

Re: IoTMadeEasy component : "Client Identifier" field supports only 20 characters

Post by miggarc »

Hi...

I also have Flowcode 6 Professional and on both, 6 and 9, if I click create a new variable, from the list we can see the string option says exactly
( default size = 20 ) .

This is (at least) coherent with what is said in IoTMadeEasy Component on its “Client Identifier” field (with mouse over).

Anyway I will try it... Lets see what happens ...

Many thanks in advance,


Miguel Garcia,
Electronic Systems Developer

mnfisher
Valued Contributor
Posts: 938
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 502 times

Re: IoTMadeEasy component : "Client Identifier" field supports only 20 characters

Post by mnfisher »

Hi Miguel,

Have a look at the code generated - view c - it looks okay!

The default string size is 20 - but if you pass without local copy then it gets passed by reference with a length. (This is probably the best way to do it - saves space on the stack)
If you pass WITH a local copy then a local variable is created of the length defined in macro definition and this needs to be large enough to handle the parameter - I think FC will just copy the first 20 (defined size) characters rather than using the (passed) size and trashing memory.

Note - this applies to other arrays - so you can have a macro parameter x[1] and pass y[100] without problem - you need a dab of C to get the size though..


Martin

miggarc
Posts: 52
Joined: Mon Jan 04, 2021 8:08 pm
Has thanked: 7 times
Been thanked: 4 times

Re: IoTMadeEasy component : "Client Identifier" field supports only 20 characters

Post by miggarc »

Hi

Thanks again for you additional information...

The problem is:

" if you pass without local copy then it gets passed by reference with a length "

I don´t know what is passing without local copy ...

Are you talking about to pass it as a global variable ?

If yes, how to change this component field to accept this ?

Many thanks in advance,


Miguel Garcia,
Electronic Systems Developer

mnfisher
Valued Contributor
Posts: 938
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 104 times
Been thanked: 502 times

Re: IoTMadeEasy component : "Client Identifier" field supports only 20 characters

Post by mnfisher »

Sorry to confuse - it was just some comments about the default size and what it affects...

You can define any size

Code: Select all

string s[100]
for example - and the examples were just showing how to pass these strings (and also arrays) as parameters to macros... Basically FC uses the string and it's length and not the size written in the definition in certain cases - which are useful to be aware of.

You can't however define a variable x[5] = "Hello world"

Martin

BenR
Matrix Staff
Posts: 1707
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 435 times
Been thanked: 598 times

Re: IoTMadeEasy component : "Client Identifier" field supports only 20 characters

Post by BenR »

Hello,

The tooltip max size of 20 looks to be incorrect, it looks like the limit is 32 and so you should be fine.

Please note that each client device needs it's own unique name and so you can call your client identifier anything. e.g. Flowcode1.

Post Reply