B4A Library MLwifi Library Updated to v4.00

Attached Java Source Code

MLWifi.zip - couldn't attach the entire Android Studio project as even zipped it was too big (900 KB) for the forum limits. If you want the entire project, private message me with your email address & I'll send it to you.

Library updated to v4.40

Added @Events so the callbacks can be auto-generated by the B4A IDE.

Library updated to v4.40

Added WifiBSSID function. Returns a string with the currently connected AP BSSID. Note that Wifi_ConnectionResult & isonline_pingdone don't require the EventName prefix.

Library updated to v4.30

Minor code tweaks & tidy up. Tested saveWifiAP, connectWifiAP, reconnectWifiAP & disconnectWifiAP on Android 4.4.2, 9 & 10.

Library updated to v4.20

Bug Fixes / Improvements:
* Added support for Android Pie.
* Improved connectivity when using saveWifiAP with Android Q+.

Library updated to v4.10

Added:

reconnectWifiAP: (reconnects to a saved Wifi network)

Parameters:
ssid - the name of the Wifi Network
timeout - fail if not connected within timeout (Ms)

Raises Wifi_ConnectionResult event on success or failure

NOTE FOR SDK 29+: Will only work if the network being connected to is not secured.
You can connect to the previously connected network by calling disconnectWifiAP
or a specific network by calling connectWifiAP with the correct parameters.

Example:
B4X:
Private Sub connectToWifi
    Private wifi As MLwifi
    'reconnect to a Wifi network saved on this device
    wifi.reconnectWifiAP("wifissid", 30000)
End Sub

Public Sub Wifi_ConnectionResult(success As Boolean)
    If success then
        'Connected - set up sockets, etc...
    Else
        'Couldn't connect...
    End If
End Sub

Bug Fixes:

isWifiConnected now correctly reports the connection state (true or false).

v4.00

connectWifiAP:
(connects to an existing Wifi Network)

Parameters:
ssid - the name of the Wifi Network
security = 0 = Open (SECURITY_OPEN), 1 = WEP (SECURITY_WEP), 2 = WPA-2/PSK (SECURITY_WPA2PSK)
password - the password or "" if the network is open
timeout - fail if not connected within timeout (Ms)

Raises Wifi_ConnectionResult event on success or failure

Example:
B4X:
Private Sub connectToWifi
    Private wifi As MLwifi

    'To connect to an open network
    wifi.connectWifiAP("wifissid", wifi.SECURITY_OPEN, "", 30000)
    'To connect to a WPA-2 secured network
    wifi.connectWifiAP("wifissid", wifi.SECURITY_WPA2PSK, "password", 30000)
End Sub

Public Sub Wifi_ConnectionResult(success As Boolean)
    If success then
        'Connected - set up sockets, etc...
    Else
        'Couldn't connect...
    End If
End Sub

saveWifiAP: (adds a Wifi network, then optionally connects)

Parameters:
ssid - the name of the Wifi Network
security = 0 = Open (SECURITY_OPEN), 1 = WEP (SECURITY_WEP), 2 = WPA-2/PSK (SECURITY_WPA2PSK)
password - the password or "" if the network is open
connect - ignored for Android Q+ (will always connect)
timeout - fail if not connected within timeout (ms)

Raises Wifi_ConnectionResult event on success or failure

Example:
B4X:
Private Sub connectToWifi
    Private wifi As MLwifi

    'To save & connect to an open network
    wifi.saveWifiAP("wifissid", wifi.SECURITY_OPEN, "", True, 30000)
    'To save & connect to a WPA-2 secured network
    wifi.saveWifiAP("wifissid", wifi.SECURITY_WPA2PSK, "password", True, 30000)
End Sub

Public Sub Wifi_ConnectionResult(success As Boolean)
    If success then
        'Connected - set up sockets, etc...
    Else
        'Couldn't connect...
    End If
End Sub

disconnectWifiAP: (disconnects from a Wifi network)

Usage:
B4X:
    Private disconnected As Boolean = MLwifi.disconnectWifiAP

Note that the connectWifiAP & saveWifiAP functions no longer return a Boolean. They now raise the Wifi_ConnectionResult(success As Boolean) callback event.

I haven't made any changes to any other library functions, nor have I tested them - so if there are functions that aren't working correctly, you'll have to let me know & I'll take a look at them. I also haven't tested the functions I did change/add beyond a couple of use cases (connecting to an ESP8266 Access Point & connecting to my home Wifi), so if there are situations that it doesn't work correctly in, you'll have to let me know.

Also note that there are some Android Q+ Wifi behaviors that are quite different to before, so I suggest you take a look at the android.net.wifi reference to give you a better idea of how the deprecated functions have been re-implemented.

- Colin.
 

Attachments

  • MLwifi400-v4.41.zip
    26 KB · Views: 1,379
  • MLwifi.zip
    8.6 KB · Views: 555
Last edited:

Computersmith64

Well-Known Member
Licensed User
Longtime User
Hi,
Further testing on Android 9:
Everything was getting more and more confusing so I went into the System Settings and reset all of the network settings so that nothing could remain to cause problems.
Now, using wifi.saveWifiAP(APName, SecType, APPass, True, Timeout) to set the new AP and wifi.removeWifiAP(W.WifiSSID) for reset IT IS WORKING!!!

I think I have a fully working solution now so can actually make some progress.
re. the 'wait fors' and '_connectionresults' all of the test App was taken from a fully working App. By which I mean it was fully working for Android versions below 9. I should be able now to put it straight back into that App. [Is that tempting fate?????]. I don't think there is any problem in the way I am using them and have never seen anything that looks like it was caused by them. Perhaps one of the experts on the forum could let me know if there something there waiting to catch me out?

Thanks, Colin, for all of your help.
There are some differences in the way APs are handled depending on the Android version & whether or not they were added manually by the user or by an app. I won't go into details, but you can experiment yourself by adding them the different ways, connecting & disconnecting & seeing what they results are.

If the test code was taken from a fully working app that was using a previous version of MLwifi, it wouldn't have implemented the Wifi_ConnectionResult callback, because it wasn't available. IIRC, the previous method of connecting was to call one of the connect functions, then sit in a loop checking isWifiConnected until it was true. The implementation of Wifi_ConnectionResult is different to that, so you might want to double-check that the code you're using is still working as you expect.

- Colin.
 

RJB

Active Member
Licensed User
Longtime User
Yes you are right, I updated the library version about three pages back!!
However I've grafted it back into the original App and, at the moment, it is all working fine.
I've no doubt that it will need tweaking as I go along but here is the latest version of the test App in case it helps anyone in future:
 

Attachments

  • WifiTest.zip
    11.5 KB · Views: 503

RJB

Active Member
Licensed User
Longtime User
Further Update!
Having put the updated Wifi functionality back into the original App I was able to do some more testing. Android 5 (API 22) worked fine. I don't have anything with Android 6 or 7 so couldn't test them. Android 8 (API 27) was showing the same problems that Android 9 had shown. I did a factory reset on it and it started to work correctly.
To cut a long story short what is happening is that more than one copy of the AP can get added to the 'Saved' list. One when the AP is connected manually on the device and one when it is added by the App (plus probably more if different apps add it?). I modified the Test App by adding the following:
B4X:
Public Sub MultiSave(APName As String, APPass As String, SecType As Int, Timeout As Int, Count As Int, Connect As Boolean)As ResumableSub
    For i = 1 To Count
        W.saveWifiAP(APName, SecType, APPass, Connect, Timeout)
        wait for Wifi_ConnectionResult (Success As Boolean)
        Log("Saving " & i & ": " & Success)
    Next
    Return Success
End Sub
Public Sub MultiRemove(APName As String, Count As Int)
    For i = 1 To Count
        If W.isSavedWifiAP(APName) Then
            Log("Removing: " & i)
            W.removeWifiAP(APName)
        Else
            Log("Not Saved: " & i)
            Exit
        End If
    Next
End Sub

Using this shows that a) the test app doesn't recognise that the AP has already been saved by something else and b) it won't remove the saved entry if it didn't save it. Presumably this has been done to avoid one app upsetting another but I'm sure it has been the cause of the problems experienced on resetting APs.

It can also cause the logging of the 'Unreachable' error mentioned in one of the previous posts.

There is also a problem in the MLwifi library Success reporting:
B4X:
Multi Save
==========
[MLwifi] XXXXXXXX saved
Saving 1: false
[MLwifi] (P) XXXXXXXX exists. Not saving.
Saving 2: false
[MLwifi] (P) XXXXXXXX exists. Not saving.
Saving 3: false
[MLwifi] (P) XXXXXXXX exists. Not saving.
Saving 4: false
[MLwifi] (P) XXXXXXXX exists. Not saving.
Saving 5: false
The AP is saved the first time but success is reported as false ("Saving 1: false"). Could this be tied up with the TimeOut value effectively setting the minimum time that save waits? i.e. waiting for success when it's already happened?
 
Last edited:

Jmu5667

Well-Known Member
Licensed User
Longtime User
Hi Colin

Great work on the library, it's a credit to you. It there any chance that you could add ActiveBSSID to show the current connection BSSID. I don't want to have to do a scan etc. I have currently used ABWifi (1.2) to do this.

Many Thanks

John.
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
Hi Colin

Great work on the library, it's a credit to you. It there any chance that you could add ActiveBSSID to show the current connection BSSID. I don't want to have to do a scan etc. I have currently used ABWifi (1.2) to do this.

Many Thanks

John.
I'll take a look in the next few days & see what I can do.

- Colin.
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
Hi Colin

Great work on the library, it's a credit to you. It there any chance that you could add ActiveBSSID to show the current connection BSSID. I don't want to have to do a scan etc. I have currently used ABWifi (1.2) to do this.

Many Thanks

John.
Library has been updated to v4.40 (attached to the first post in this thread). Added WifiBSSID function which returns a string. Tested (very briefly) on Android v4.4.2, v10 & v11.

- Colin.
 

jwgf

Member
Hi Colin, first I want to thank you for the effort in maintaining this library.
Unfortunately my experience has not been good, I have been trying to reliably connect an ESP8266 in AP mode (without internet connection) for almost a year, and I have not succeeded, in some mobiles it does not connect at all in others it does so in a way Randomly, I have tried with many devices from Android 4 to 9 with different results according to the brand and model of the phones. I have followed all the suggestions that I have come across but I cannot achieve something general and reliable.
If someone has been able to make ESP work with these characteristics, I ask you please to upload a small complete example, an app with a button that connects to ESP8266 and sends any command, and that works on any mobile. It would be a great advance for many projects that do not require an internet connection.
Thank you all for your efforts, Jorge.
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
Hi Colin, first I want to thank you for the effort in maintaining this library.
Unfortunately my experience has not been good, I have been trying to reliably connect an ESP8266 in AP mode (without internet connection) for almost a year, and I have not succeeded, in some mobiles it does not connect at all in others it does so in a way Randomly, I have tried with many devices from Android 4 to 9 with different results according to the brand and model of the phones. I have followed all the suggestions that I have come across but I cannot achieve something general and reliable.
If someone has been able to make ESP work with these characteristics, I ask you please to upload a small complete example, an app with a button that connects to ESP8266 and sends any command, and that works on any mobile. It would be a great advance for many projects that do not require an internet connection.
Thank you all for your efforts, Jorge.
Hi Jorge,

There are examples of how to connect in the first post of this thread. I have tested the library on several of my own devices connecting to my home Wifi (secured) & an ESP8266 in AP mode (both secured & unsecured) without an internet connection & not had any issues. Having said that, nobody is going to be able to write an example that will be guaranteed to work on every android device. There are too many hardware variations & OEM "flavors" of Android to be able to confidently say that any given piece of code will be 100% guaranteed to work across all of them.

You start by saying you can't reliably connect to an AP, but then you ask for an example that will connect & send data, so what is it you're having issues with - the connection, or what's happening after the connection? If you provide some examples, errors, etc relating to the issues you're having, someone might be able to help point you in the right direction.

- Colin.
 

jwgf

Member
Colin, thanks for your answer, as an example I am sending you this super simple code, which returns "not connected", on a 7 "tablet with 6.01.
I tried to connect directly with the ESP8266 AP and it works but not in the app.
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private xui As XUI
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
    xui.MsgboxAsync("Hello world!", "B4X")
    connectToWifi
End Sub

Private Sub connectToWifi
    Private wifi As MLwifi
    wifi.saveWifiAP("Nuoto", wifi.SECURITY_WPA2PSK, "abcdefgh", True,30000)
End Sub

Public Sub Wifi_ConnectionResult(success As Boolean)
    If success Then
        Log("Me conecte !!")
        'Connected - set up sockets, etc...
    Else
        Log("No me pude conectar :( ")
        'Couldn't connect...
    End If
End Sub

And the ESP code
B4X:
#Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 600
#End Region

Sub Process_Globals
    Public Serial1 As Serial
    Private server As WiFiServerSocket
    Private d1 As D1Pins
    Private wifi As ESP8266WiFi
    Private astream As AsyncStreams
    Private timer1 As Timer
    Private pin As Pin
    Private ser As B4RSerializator
End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
    If wifi.StartAccessPoint2("Nuoto","abcdefgh") = True Then
        server.Initialize(51042, "server_NewConnection")
        server.Listen
        Log("Waiting for connection.")
    Else
        Log("Failed to connect to Wifi.")
    End If

    timer1.Initialize("timer1_Tick", 1000)
    pin.Initialize(d1.D6, pin.MODE_INPUT)
End Sub

Sub Server_NewConnection (NewSocket As WiFiSocket)
    Log("new connection")
    astream.InitializePrefix(NewSocket.Stream, False, "astream_NewData", "astream_Error")
    timer1.Enabled = True
End Sub

Sub Timer1_Tick
    astream.Write(ser.ConvertArrayToBytes(Array("Sent from ESP", Millis)))
End Sub

Sub astream_NewData (Buffer() As Byte)
    Dim be(10) As Object 'used as a storage buffer.
    Dim objects() As Object = ser.ConvertBytesToArray(Buffer, be)
    Log("Recieved:")
    For Each o As Object In objects
        Log(o)
    Next
End Sub

Sub Astream_Error
    Log("Error.")
    server.Listen
    timer1.Enabled = False
End Sub

I know it is very basic but it does not connect.
In another device with android 8 it can connect but does not open the socket
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
Colin, thanks for your answer, as an example I am sending you this super simple code, which returns "not connected", on a 7 "tablet with 6.01.
I tried to connect directly with the ESP8266 AP and it works but not in the app.
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Private xui As XUI
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("Layout")
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub Button1_Click
    xui.MsgboxAsync("Hello world!", "B4X")
    connectToWifi
End Sub

Private Sub connectToWifi
    Private wifi As MLwifi
    wifi.saveWifiAP("Nuoto", wifi.SECURITY_WPA2PSK, "abcdefgh", True,30000)
End Sub

Public Sub Wifi_ConnectionResult(success As Boolean)
    If success Then
        Log("Me conecte !!")
        'Connected - set up sockets, etc...
    Else
        Log("No me pude conectar :( ")
        'Couldn't connect...
    End If
End Sub

And the ESP code
B4X:
#Region Project Attributes
    #AutoFlushLogs: True
    #CheckArrayBounds: True
    #StackBufferSize: 600
#End Region

Sub Process_Globals
    Public Serial1 As Serial
    Private server As WiFiServerSocket
    Private d1 As D1Pins
    Private wifi As ESP8266WiFi
    Private astream As AsyncStreams
    Private timer1 As Timer
    Private pin As Pin
    Private ser As B4RSerializator
End Sub

Private Sub AppStart
    Serial1.Initialize(115200)
    Log("AppStart")
    If wifi.StartAccessPoint2("Nuoto","abcdefgh") = True Then
        server.Initialize(51042, "server_NewConnection")
        server.Listen
        Log("Waiting for connection.")
    Else
        Log("Failed to connect to Wifi.")
    End If

    timer1.Initialize("timer1_Tick", 1000)
    pin.Initialize(d1.D6, pin.MODE_INPUT)
End Sub

Sub Server_NewConnection (NewSocket As WiFiSocket)
    Log("new connection")
    astream.InitializePrefix(NewSocket.Stream, False, "astream_NewData", "astream_Error")
    timer1.Enabled = True
End Sub

Sub Timer1_Tick
    astream.Write(ser.ConvertArrayToBytes(Array("Sent from ESP", Millis)))
End Sub

Sub astream_NewData (Buffer() As Byte)
    Dim be(10) As Object 'used as a storage buffer.
    Dim objects() As Object = ser.ConvertBytesToArray(Buffer, be)
    Log("Recieved:")
    For Each o As Object In objects
        Log(o)
    Next
End Sub

Sub Astream_Error
    Log("Error.")
    server.Listen
    timer1.Enabled = False
End Sub

I know it is very basic but it does not connect.
In another device with android 8 it can connect but does not open the socket

I'm guessing that you have previously saved this network with a different app. For devices running Android versions below P, the connection to the network is achieved by calling WifiManager.enableNetwork. Note from the documentation that Applications are not allowed to enable networks created by other applications. If you go into the settings on your device & forget that AP, then run your test app again, I suspect it will work.

Also, try adding:
B4X:
wifi.debug = True
before you start making calls. This will allow you to see debug logs from the library & might help you figure out what's going on.

- Colin.
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
In another device with android 8 it can connect but does not open the socket
Without seeing your B4A socket code, it's hard to say why.

- Colin.
 

jwgf

Member
Sorry Colin, but where should I call WifiManager.enableNetwork, inside the manifest? How to do this, thanks, Jorge

P.S. when I can connect I will try the socket, and I inform you, I did not put this code in the example to keep it basic
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
Sorry Colin, but where should I call WifiManager.enableNetwork, inside the manifest? How to do this, thanks, Jorge

P.S. when I can connect I will try the socket, and I inform you, I did not put this code in the example to keep it basic
You don't call WifiManager.enableNetwork - that's what the library does. The point I was making was that if you had saved that AP with another app (eg: a previous test app), you can't connect to it with your current test app. An app can only connect to an AP that has been either saved by the user manually, or that the app itself has saved.

So my suggestion (again) to test it is: go into the Wifi settings on your device & forget that AP, then run the test app again.

- Colin.
 

jwgf

Member
Thanks Colin for your help and patience, I didn't understand.
It worked !!, I tried the socket and it also works, to clarify, if I write an app and then another with another name and use the same connection routine with the same parameters, it will not connect unless I forget the connection on the phone?
Could it happen that in successive compilations of the same app the effect is the same?
How should I connect to devices with android 9 and higher?
Thank you for your support, Jorge.
 

jwgf

Member
Well, the joy did not last long.
It worked well in a Tablet 7 "with android 6 and also in a Motorola G3 with android 6, but with a Samsung J7 prime with android 8.1 it does not connect, it asks if it remains connected to the device without internet and answering that if it does not connect. Place the routine that Erel gave for these cases, the phone no longer asks but does not connect.
I send the debug
Thanks for any help


B4X:
** Activity (main) Resume **
[MLwifi] Nuoto saved
[MLwifi] Connecting to "Nuoto"
[type: WIFI[] - WIFI, state: CONNECTED/CONNECTED, reason: (unspecified), extra: "Eratostenes", failover: false, available: true, roaming: false]
[type: WIFI[] - WIFI, state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: <unknown ssid>, failover: false, available: true, roaming: false]
[type: WIFI[] - WIFI, state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: <unknown ssid>, failover: false, available: true, roaming: false]
[type: WIFI[] - WIFI, state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: <unknown ssid>, failover: false, available: true, roaming: false]
[type: WIFI[] - WIFI, state: DISCONNECTED/DISCONNECTED, reason: (unspecified), extra: "Eratostenes", failover: false, available: true, roaming: false]
[type: WIFI[] - WIFI, state: CONNECTING/CONNECTING, reason: (unspecified), extra: "Eratostenes", failover: false, available: true, roaming: false]
[type: WIFI[] - WIFI, state: CONNECTING/CONNECTING, reason: (unspecified), extra: "Nuoto", failover: false, available: true, roaming: false]
[type: WIFI[] - WIFI, state: CONNECTING/AUTHENTICATING, reason: (unspecified), extra: "Nuoto", failover: false, available: true, roaming: false]
[type: WIFI[] - WIFI, state: CONNECTING/AUTHENTICATING, reason: (unspecified), extra: "Nuoto", failover: false, available: true, roaming: false]
[type: WIFI[] - WIFI, state: CONNECTING/CONNECTING, reason: (unspecified), extra: "Nuoto", failover: false, available: true, roaming: false]
[type: WIFI[] - WIFI, state: CONNECTING/OBTAINING_IPADDR, reason: (unspecified), extra: "Nuoto", failover: false, available: true, roaming: false]
[type: WIFI[] - WIFI, state: CONNECTING/OBTAINING_IPADDR, reason: (unspecified), extra: "Nuoto", failover: false, available: true, roaming: false]
[type: WIFI[] - WIFI, state: CONNECTED/CONNECTED, reason: (unspecified), extra: "Nuoto", failover: false, available: true, roaming: false]
[type: WIFI[] - WIFI, state: CONNECTED/CONNECTED, reason: (unspecified), extra: "Nuoto", failover: false, available: true, roaming: false]
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
No me pude conectar :(
[/CÓDIGO]

Este es el código Erel para que el teléfono no pregunte, funciona bien, pero tampoco conecta

[CODE=b4x]Sub PreferWifiRouting
    Dim p As Phone
    If p.SdkVersion >= 21 Then
        Dim ctxt As JavaObject
        ctxt.InitializeContext
        Dim builder As JavaObject
        builder.InitializeNewInstance("android.net.NetworkRequest.Builder", Null)
        Dim manager As JavaObject = ctxt.RunMethod("getSystemService", Array("connectivity"))
        builder.RunMethod("addTransportType", Array(1)) 'NetworkCapabilities.TRANSPORT_WIFI
        Dim event As JavaObject
        event.InitializeNewInstance(Application.PackageName & ".main$NetworkCallback", Null)
        manager.RunMethod("requestNetwork", Array(builder.RunMethod("build", Null), event))
        Wait For network_available (Network As Object)
        Log("Network found.")
'        Dim cm As JavaObject
'        Return cm.InitializeStatic("android.net.ConnectivityManager").RunMethod("setProcessDefaultNetwork", Array(Network))
    End If
'    Return False
End Sub

#if Java
public static class NetworkCallback extends android.net.ConnectivityManager.NetworkCallback {
  public void onAvailable(android.net.Network network) {
         processBA.raiseEventFromUI(null, "network_available", network);
  }
}
#End If

PD in all cases uninstall the app and delete the connection on the phone
 

Peter Simpson

Expert
Licensed User
Longtime User
Hello Colin,
I previously answered a question on the forum, whilst answering that question I noticed that the B4A IDE was not autogenerating your libraries event subs. I know from past experiences using the previous two iterations (the original by HotShoe and the update by BGSoft) of the MLWiFi libraries that the B4A IDE has always autogenerating the event subs for the MLWiFi library, but not with your version library.

The following two even subs are in the previous two iterations of the MLWiFi library and can be autogenerated by the IDE.
1620923509397.png


The above two event subs are missing in you MLWiFi library V4.40
1620923356787.png


PLEASE NOTE:
You can still use these subs if you manually create the subs yourself.


Thank you...
 

Computersmith64

Well-Known Member
Licensed User
Longtime User
Hello Colin,
I previously answered a question on the forum, whilst answering that question I noticed that the B4A IDE was not autogenerating your libraries event subs. I know from past experiences using the previous two iterations (the original by HotShoe and the update by BGSoft) of the MLWiFi libraries that the B4A IDE has always autogenerating the event subs for the MLWiFi library, but not with your version library.

The following two even subs are in the previous two iterations of the MLWiFi library and can be autogenerated by the IDE.
View attachment 113343

The above two event subs are missing in you MLWiFi library V4.40
View attachment 113342

PLEASE NOTE:
You can still use these subs if you manually create the subs yourself.


Thank you...
Thanks for pointing that out Peter. I've added the 3 events (2 for MLScan & 1 for MLwifi) & attached v4.41 to the first post in this thread. The only issue I can see is that 2 of the events don't require the user to provide an event prefix, however the auto-generator in B4A still prepends "EventName" to them. I don't know how to stop it doing this.

- Colin.
 

Peter Simpson

Expert
Licensed User
Longtime User
Thanks for pointing that out Peter. I've added the 3 events (2 for MLScan & 1 for MLwifi) & attached v4.41 to the first post in this thread. The only issue I can see is that 2 of the events don't require the user to provide an event prefix, however the auto-generator in B4A still prepends "EventName" to them. I don't know how to stop it doing this.

- Colin.

Hello Colin,
Yesterday I tested your updated library, and whilst the IDE does now create the event subs, the signature for the MLScan sub returns a list that does not work correctly (well I can't get it to work anyway). If I change the sub signature from List to String then it works perfectly fine. I believe that everything else is working as planned.

So once I change the event signature from List to String, everything works as planned.

Cheers...
 
Top