I cannot get any method to execute, they all say not found even in examples copy directly from M Dash GitHub.
I used to use mDashExport
mDashExport(“setPin”, setPin, NULL);
curl: (6) Could not resolve host: application
curl: (3) URL rejected: Bad hostname
{
“id”: 12,
“method”: “rpc_gpio_write”,
“error”: {
“code”: -32601,
“message”: “rpc_gpio_write not found”
}
}
I cannot upgrade until I figure out how to make an RPC call.
Please any help would be greatly appreciated!!
Thanks for your reply. I am able to get the built-in RPC functions to work. However I need to be able to make calls to my own custom functions. The code is copied directly from the rpc_gpio_write example.
static void rpc_gpio_write(struct mg_rpc_req *r) {
long pin = mg_json_get_long(r->frame, “$.params.pin”, -1);
long val = mg_json_get_long(r->frame, “$.params.val”, -1);
if (pin < 0 || val < 0) {
mg_rpc_err(r, 500, “%Q”, “pin and val required”);
} else {
pinMode(pin, OUTPUT);
digitalWrite(pin, val);
mg_rpc_ok(r, “true”);
}
}
I used to use mDashExport(rpc_gpio_write); To make rpc_gpio_write visable but mDashExport is apparently no longer supported.
You are truly a Godsend! I searched for 4 days trying to find a replacement for mDashExport(). Unfortunately there’s no cross reference from the old libraries to the current ones.
mg_rpc_add() totally changed my day!
I have updated - mDash OLD Funtions - replacements for mDash 2.1.16
Hope we can meet someday, dinner’s on me.
Many Many Thanks,
Brad