I have seen an old thread with this inline C suggestion for setting the wifi.hostname (what appears in the router connections list):
however I'd like to pass the hostname via the call to the inline C rather than use a fixed global variable. So I tried this:
but this results in a watchdog reset when I try running the code. I am guessing that char* c is perhaps not seen as a string for the WiFi.hostname function. Can someone enlighten me?
B4X:
#if C
void SetHostName(B4R::Object* o) {
WiFi.hostname(b4r_main::_hostname->data);
}
#end if
B4X:
#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