Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set device name to node name in json file #253

Closed
Hung6129 opened this issue Oct 17, 2022 · 14 comments
Closed

How to set device name to node name in json file #253

Hung6129 opened this issue Oct 17, 2022 · 14 comments

Comments

@Hung6129
Copy link

When i provisioned a node then i export json file
In the node list the node name is default "My node " like is always
So i want to set the node name in the json file according to the device name that i provisioning

from this
image

to this

image

thanks

@Hung6129
Copy link
Author

Hung6129 commented Oct 17, 2022

Am i doing wrong some where
Do i have to change something on the native code ? Pls help
In the android app https://github.com/NordicSemiconductor/Android-nRF-Mesh-Library
when i use it to export json file it still keep my device name also in ios app

@ghost
Copy link

ghost commented Oct 17, 2022

Hi @Hung6129,

Nothing wrong here, we just don't expose the api and we don't use device name when creating node object !

This looks like a feature request 👍

@Hung6129
Copy link
Author

hope this feature will appear soon

@ghost
Copy link

ghost commented Oct 17, 2022

Yes, just a reminder : you shouldn't rely on device name to identify it. So I hope this is not a blocker for you ?

@Hung6129
Copy link
Author

Hung6129 commented Oct 18, 2022

i don't identify it by using device name, i use uuid
i just need to show the device name on the json file just like the android app when i export it

bc i will send that json file to the server and they want to know the device name in the list node :(

can you give me some solution to get the device name instead of the default name "My node"

i see that in the DiscoveredDevice models has the name
Now how can i add it into the ProvisionedMeshNode
Or should i need to add it in provisioning function
image

Thanks

@ghost
Copy link

ghost commented Oct 18, 2022

Hello @Hung6129,

If you want to try and implement it, I think it's more on the native code that you have to change something. The provisioning process may look complex, so you better begin by just exposing Node.setName from Nordic API

@him1010
Copy link

him1010 commented Nov 28, 2022

Hello
I am new to app development and I want to save the new provisioned device with its original name or provide a name for it. If possible can you help me with this.

Thanks

@Hung6129
Copy link
Author

Hung6129 commented Nov 29, 2022

image

hello @him1010
Well for now i added that line to set the provisioned nodeName after the provisioning step done
It works and show the name of the device instead of My Node
@R0m4in-dooz sir, a feature request ??

@ghost
Copy link

ghost commented Nov 29, 2022

Hello !

Ah yes this line is ok ✅

Feel free to open a PR 👍

It could be great to also expose the name setter in mesh mngr in case you want to change it later (user customization for instance)

@him1010
Copy link

him1010 commented Nov 29, 2022

Hello @Hung6129
Thanks for the suggestion. It worked.
@R0m4in-dooz how can I expose the name setter in mesh manager and use it, if you could give an example that would be really helpful.

Thanks

@ghost
Copy link

ghost commented Dec 4, 2022

Hello @him1010,

Actually I found that it is already exposed, see models file for mesh nodes, there is ProvisionedMeshNodes which defines an async setter : https://github.com/OZEO-DOOZ/nrf_mesh_plugin/blob/master/lib/src/models/mesh_node/provisioned_mesh_node.dart

@ghost
Copy link

ghost commented Dec 4, 2022

So to do it after provisioning you can write :

// with an instance that implements IMeshNetwork
IMeshNetwork _meshNetwork;
// and target node´s unicast
int unicast;

final node = await _meshNetwork.getNode(unicast);
// /!\ the operation will be asynchronous, wait for onNetworkUpdated callback
node.nodeName = 'my awesome mesh node';

@him1010
Copy link

him1010 commented Dec 8, 2022

Hi @R0m4in-dooz
Thank you for the suggestion, you were a great help.

@ghost
Copy link

ghost commented Dec 8, 2022

This issue seems resolved. If you think it's not the case, feel free to re-open it 😊

@ghost ghost closed this as completed Dec 8, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants