Hi and sorry to raise an old quesiton again, but was advised to raise a new question.
I've seen an old thread about setting the hostname of an ESP8266 and Erel posted some code to asnwer to OP.
B4X:
Private Sub AppStart
Serial1.Initialize(115200)
Log("AppStart")
Dim bb() As Byte = "abc"
RunNative("SetHostName", bb)
End Sub
#if C
void SetHostName(B4R::Object* o) {
B4R::Array* b = (B4R::Array*)B4R::Object::toPointer(o);
char* c = (char*)b->data;
WiFi.hostname(c);
}
#end if
I've done this, but I keep getting an error saying 'wifi' was not declared in this scope.
It's probably something very silly I've done, but could someone advise.
Yes, that's actually what I found but wasn't sure as you had WiFi in the question.
Always worth trying the casing anyway - I often find it's wrong when I copy code from on-line sources!!
So I've just got my first chance at testing the SetHostName and it crashes, the ESP just reboots over and over again.
I haven't added the crash text, but can do, but first I just wanted to ask if anyone had got the SetHostName working as per Erel's original code snippet?
Thanks in advance for any help, suggestions, guidance etc.
Dave