Hello everyone,
I’m trying to add RPC Handler using java in my init.js file of my empty folder. I use the following mos.yml code and init.js code and flash it in my esp8266. I’m using windows 10 OS and mos.exe to execute mos commands
#mos.yml:
author: mongoose-os
description: A Mongoose OS app skeleton
version: 1.0
libs_version: ${mos.version}
modules_version: ${mos.version}
mongoose_os_version: ${mos.version}
tags:
- js
filesystem:
- fs
build_vars:
MGOS_WIFI_ENABLE_AP_STA: 1
libs:
manifest_version: 2017-09-29
#init.js:
RPC.addHandler('Sum', function(args) {
if (typeof(args) === 'object' && typeof(args.a) === 'number' && typeof(args.b) === 'number') {
return args.a + args.b;
} else {
return {error: -1, message: 'Bad request. Expected: {"a":N1,"b":N2}'};
}
});
After building and flashing the code in esp8266, the RPC Call is not added in the RPC.Lists.
Please anyone guide me
Thanks in advance!!