Device Discovery

Discussion to talk about software related topics only.
Post Reply
SeeCwriter
Posts: 606
Joined: Mon May 12, 2008 10:55 am

Device Discovery

Post by SeeCwriter »

Using v3.3.8. On the device discovery webpage one of the columns is "Application" which displays the string in AppName. Using an example program the AppName string is displayed immediately. But with my application, it takes about 20-minutes to show up. The device is found immediately, it's just the AppName that is blank for about 20-minutes. And it doesn't matter how many times I hit the Refresh button. Once the AppName is displayed, if I reboot, it disappears for another 20-minutes. But if I open the ConfigPage, the AppName string is displayed under the Sys tab.

The only difference I can see between how the example programs set AppName and how my app sets AppName is that, in the examples AppName is set at its declaration whereas my app sets it during the device initialization phase because the string contains info that is dynamic. Is there something I can do to speed up how soon AppName gets displayed?

Code: Select all

char MyAppName[64];
const char *AppName = MyAppName;
...
void UserMain(void *pd)
{
  initmain();
  ...
}

void initmain()
{
  init();                 // Initialize network stack. This must be first!
  InitFlashFileSystem();  // Init Flash file system. Must be second! This takes 8-sec.
  LoadParameters();
  sprintf( MyAppName, "%s v%s ser#%s", FW_FAMILY,  FW_VERSION, serial_no );
  ...
}
User avatar
pbreed
Posts: 1080
Joined: Thu Apr 24, 2008 3:58 pm

Re: Device Discovery

Post by pbreed »

#include <config_obj.h>


sys.system_app=AppName;

//I'm suprised that it ever changes.... the sys.system_app is set in global construction.
This should fix it in 30 seconds or so...

If you can push you code ABOVE init and add the line above it should work on the first message.
If you must be after init
If you want it to be even quicker (IE at that point 8 seconds after init the first discovery packet has been sent)
One might be able to modify the discovery servlet that manages this to force an update quicker....

Paul
User avatar
pbreed
Posts: 1080
Joined: Thu Apr 24, 2008 3:58 pm

Re: Device Discovery

Post by pbreed »

also the next release will support mDNS local names.
SeeCwriter
Posts: 606
Joined: Mon May 12, 2008 10:55 am

Re: Device Discovery

Post by SeeCwriter »

Since there are multiple devices on the same network, I added the device serial number to AppName to be able to identify each device. But the serial number is not available until I initialize my own code and copy the unit's configuration parameters from non-volatile memory. Through much painful testing, if init() and InitFlashFileSystem() are not the first 2 functions, the network does not operate correctly.
sys.system_app = AppName throws a compiler error about trying to assign a const char * to a config_obj. But changing it to sys.system_app.ModifyValue(AppName) works. I added it before init() and it gets displayed immediately, but it doesn't have the serial number because my own initialization hasn't happened yet. I update AppName later after my init to add the serial number, but it still takes over 10 minutes to update in discovery webpage.

It is what it is, not a show stopper. I can just look in the ConfigPage for the complete AppName string. Thanks for the feedback.
User avatar
pbreed
Posts: 1080
Joined: Thu Apr 24, 2008 3:58 pm

Re: Device Discovery

Post by pbreed »

This should work...
Find the network interface you are using....
(MODM7 its enet0)
(MOD5441X its enet0 or enet1 )

I'll assume enet0.

Before init:
enet0.discovery_interval=10; //Redo discovery every 10 seconds....

after your full init is done... and you have set your name....
set it back to 15 min ie 900.

That should get you a quick update...

Paul
Post Reply