le_dcs_GetChannels doesn't return wifi networks

I’m trying to use the new legato dcs api to setup the wifi channel, but I’m hitting a roadblock because I cannot get the api le_dcs_GetChannels to return ANY wifi networks. I even see log statements saying that it has found them. Is this a bug? Attached is a very simple app that starts up and calls the api.

testNetworkApp.zip (449.0 KB)

Following is the logs from the test:
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | dcsDaemon[1822]/dcsWifi T=main | dcsWifi.c WifiReadScanResults() 832 | Wifi result: SSID = TheDangerZone, BSSID = 00:11:32:ce:b7:eb, AP reference 0x6b, signal strength = -38
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 987 | Get next AP
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c IsScanRunning() 584 | IsScanRunning .0
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 1004 | AP ref = 0x26b
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 1014 | AP ref = 0x26b
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetSsid() 1134 | AP ref 0x26b
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetSsid() 1154 | apPtr->AccessPoint.ssidLength 13
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 987 | Get next AP
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c IsScanRunning() 584 | IsScanRunning .0
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 1004 | AP ref = 0x46b
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 1014 | AP ref = 0x46b
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetSsid() 1134 | AP ref 0x46b
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetSsid() 1154 | apPtr->AccessPoint.ssidLength 10
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetSignalStrength() 1045 | Get signal strength
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetBssid() 1082 | AP ref 0x46b
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | dcsDaemon[1822]/dcsWifi T=main | dcsWifi.c WifiReadScanResults() 832 | Wifi result: SSID = ATTWAeuQXt, BSSID = f4:17:b8:d8:f1:87, AP reference 0x46b, signal strength = -81
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 987 | Get next AP
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c IsScanRunning() 584 | IsScanRunning .0
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 1004 | AP ref = 0x66b
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 1014 | AP ref = 0x66b
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetSsid() 1134 | AP ref 0x66b
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetSsid() 1154 | apPtr->AccessPoint.ssidLength 0
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetSignalStrength() 1045 | Get signal strength
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetBssid() 1082 | AP ref 0x66b
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | dcsDaemon[1822]/dcsWifi T=main | dcsWifi.c WifiReadScanResults() 832 | Wifi result: SSID = , BSSID = ae:ae:19:b3:a7:28, AP reference 0x66b, signal strength = -77
May 20 17:17:38 swi-mdm9x28-wp user.err Legato: =ERR= | dcsDaemon[1822]/dcsWifi T=main | dcsWifi.c DcsWifiCreateConnDb() 569 | Cannot create wifi connection db with null SSID
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 987 | Get next AP
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c IsScanRunning() 584 | IsScanRunning .0
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetNextAccessPoint() 1019 | AP not found
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | dcsDaemon[1822]/dcsWifi T=main | dcsWifi.c WifiReadScanResults() 859 | Wifi SSID results: 2 found
May 20 17:17:38 swi-mdm9x28-wp user.debug Legato: DBUG | wifiService[1996]/daemon T=main | le_wifiClient.c le_wifiClient_GetCurrentConnection() 1177 | AP reference of currently selected connection: (nil)
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | dcsDaemon[1822]/dcs T=main | dcsTech.c le_dcsTech_CollectChannelQueryResults() 702 | Query channel list results collected from technology 1, retcode 0, list size 2
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | dcsDaemon[1822]/dcs T=main | dcsTech.c DcsTechPostChannelList() 681 | Posting collected channel list to apps of size 36
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | dcsDaemon[1822]/dcsWifi T=main | dcsWifi.c DcsWifiClientStop() 291 | Stopping Wifi client
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | wifiMonitorExe[30376]/wifiMonitor T=main | wifiMonitor.c ClientChannelQueryHandler() 90 | Received channel query result 0, channel list size 36

I see this line says it has at least 2 wifi networks in the list:
dcsTech.c le_dcsTech_CollectChannelQueryResults() 702 | Query channel list results collected from technology 1, retcode 0, list size 2

When I look at the returned list, its all ethernet and cellular connections.
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | wifiMonitorExe[30376]/wifiMonitor T=main | wifiMonitor.c ClientChannelQueryHandler() 101 | Available channel #1: name 1 from technology 2, state 0, reference 0x3bb
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | wifiMonitorExe[30376]/wifiMonitor T=main | wifiMonitor.c ClientChannelQueryHandler() 101 | Available channel #2: name 2 from technology 2, state 0, reference 0x5bb
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | wifiMonitorExe[30376]/wifiMonitor T=main | wifiMonitor.c ClientChannelQueryHandler() 101 | Available channel #3: name 3 from technology 2, state 0, reference 0x7bb
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | wifiMonitorExe[30376]/wifiMonitor T=main | wifiMonitor.c ClientChannelQueryHandler() 101 | Available channel #4: name 4 from technology 2, state 0, reference 0x9bb
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | wifiMonitorExe[30376]/wifiMonitor T=main | wifiMonitor.c ClientChannelQueryHandler() 101 | Available channel #5: name ecm0 from technology 3, state 0, reference 0x1bb
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | wifiMonitorExe[30376]/wifiMonitor T=main | wifiMonitor.c ClientChannelQueryHandler() 101 | Available channel #6: name from technology 0, state 0, reference (nil)
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | wifiMonitorExe[30376]/wifiMonitor T=main | wifiMonitor.c ClientChannelQueryHandler() 101 | Available channel #7: name from technology 0, state 0, reference (nil)
May 20 17:17:38 swi-mdm9x28-wp user.info Legato: INFO | wifiMonitorExe[30376]/wifiMonitor T=main | wifiMonitor.c ClientChannelQueryHandler() 101 | Available channel #8: name from technology 0, state 0, reference (nil)

I’m running Legato 19.11.3 Legato version for WP76xx on mangoh yellow hardware.

Did you try "wifi client scan”

I did and it worked fine for our sample application, but we are trying to use the new api le_dcs. Based on my findings, this api 1) Has bugs so that valid wifi lists are not properly added to the list of availiable connections or 2) There is some unknown and undocumented prerequisite for the return of le_dcs_GetChannels to include wifi networks that the scan found.

Normally i used "wifi client scan” only

That solution works for a manual test, but not a production setup. Could someone from development team look at the app I provided and give feedback if in fact the api is 1) Broken or 2) Not fully documented?

Why it cannot be used in production?

wifi command is typed in the command line, and in production setup, there will be no user with terminal access. We need to have app controlling with various api’s like le_data or le_dcs. le_data works, but from documentation, it seems to be preferred for future flexibility that we should use le_dcs. The le_dcs api isn’t what is working.

You can port the source code of "wifi client scan” to your code

We have ported most of that code over to preliminary application, but there are still issues when using it with drawbacks.

  1. DNS isn’t setup automatically
  2. I believe to run the system() command to setup DNS as per recommendation from earlier forum post causes us to run in an unsandboxed mode.
  3. That application I don’t think has any retry logic built-in after wifi beacon loss etc. The dcs service I see documented in Data Channel Service - Legato Docs should have all this functionality already developed. Appreciate the guidance for a work-around, but at this point I would appreciate if you could just compile the app and see if at least what I’m reporting is a bug on everyones setup.

You can run two app, one is unsandboxed, one is sandboxed.

When you call system() api, you can use ipc to ask the unsandboxed app to run it