Hello everybody,
i would like to pass an IP address direct to the Inline C# "Void SetIP Sub"
Is there a way?
This code works.
I passed an array of bytes und used (o->toULong) to convert the object but i don´t get the right IP
The result IP is: 132.242.254.63
I used bit operations to change from "Big Endian" to "Little Endian".
The result IP is: 63.254.242.132 'hmmm.... not the desired result
Thank You
i would like to pass an IP address direct to the Inline C# "Void SetIP Sub"
Is there a way?
This code works.
B4X:
RunNative( "SetIP" , Null )
#if C
void SetIP(B4R::Object* o) {
IPAddress ip(192, 168, 10, 101);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);
WiFi.config(ip, gateway, subnet);
}
#end if
I passed an array of bytes und used (o->toULong) to convert the object but i don´t get the right IP
B4X:
'Process_Globals
Public WiFiIP() As Byte = Array As Byte(192, 168, 10, 101)
'Sub
Private Sub SetClientStation_IP(Byte1() As Byte) 'IP As Object
'Log("set WLAN_Station_IP: ", Byte1)
RunNative("SetIP", Byte1)
End Sub
#if C
void SetIP(B4R::Object* o) {
uint32_t myInt1;
myInt1 = (o->toLong());
IPAddress gateway(192, 168, 0, 1);
IPAddress subnet(255, 255, 255, 0);
WiFi.config(myInt1, gateway, subnet);
}
#end if
The result IP is: 132.242.254.63
I used bit operations to change from "Big Endian" to "Little Endian".
The result IP is: 63.254.242.132 'hmmm.... not the desired result
Thank You