// ************************************************************
// *** IMPORTS
// ************************************************************
const wifi = require("Wifi");
wifi.enableMDNS = function (hostname, serviceType, port, callback) {
let mdns = "AT+MDNS=1," + JSON.stringify(hostname) + "," + JSON.stringify(serviceType) + "," + JSON.stringify(port) + "\r\n";
this.at.cmd(mdns, 500, function (d) {
callback(d);
});
};
// ************************************************************
// *** MAIN
// ************************************************************
/*
* Called on boot
*/
function onInit() {
wifi.startAP("EspruinoAP", { password: "0123456789", authMode: "wpa2" }, function (err) {
if (err) throw err;
console.log("AP created!");
wifi.enableMDNS("abcd", "iot", 80, function (result) {
console.log("enableMDNS result: " + result);
});
});
}
That was my guess as well, but replacing this with wifi gives me exactly the same error 🤔.
```
2v06 (c) 2019 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations: http://espruino.com/Donate
WARNING: Scan stop failed
WARNING: set rssi scan not implemeted yet
Running onInit()...
AP created!
Uncaught Error: Cannot read property 'cmd' of undefined
at line 2 col 12
wifi.at.cmd(mdns, 500, function (d) {
^
in function "enableMDNS" called from line 6 col 10
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Sure, here it is 😊:
That was my guess as well, but replacing
this
withwifi
gives me exactly the same error 🤔.```
2v06 (c) 2019 G.Williams
Espruino is Open Source. Our work is supported
only by sales of official boards and donations:
http://espruino.com/Donate