Copyright © https://mongoose-os.com

Mongoose OS Forum

frame
ATTENTION! This forum has moved to:

https://community.mongoose-os.com

Do not post any new messages.

Enable Bluetooth after configuration is set

Is there a way to set Bluetooth enabled using mjs after the wifi credentials have been set? I would like to enable bluetooth from the code after the wifi credentials have been enabled.

Comments

  • SergeySergey Dublin, Ireland

    Yes, just set bt.enable to true

  • edited August 2017

    I was trying to figure out the best way of doing that. What's the best way of doing that, an RPC call? I think I am missing something obvious but I am not sure what.

    I tried doing it this way in my init.js with the following code:

    RPC.call(RPC.LOCAL, 'Config.Save', { "bt" : {"enable": true , "config_enabled" : true , "adv_enable" : true , "keep_enabled" : true }}, function (resp, ud) {
    print("RESPONSE" + JSON.stringify(resp))
    }, null);

    The response was null and this was written into the config9.json file. However it seems like it didn't write anything at all to the file.

    I assumed to do this based on the following documentation at the links below:

    https://mongoose-os.com/docs/libraries/remote_management/rpc-service-config.html
    https://mongoose-os.com/docs/libraries/core/rpc.html

    I appreciate all your help you have given me and thank you! :)

  • rojerrojer Dublin, Ireland

    you need to call Config.Set, then Config.Save. sorry, we should really make it simpler (set + save + reboot in one call), but for now...

  • Thank you! I got it working now that you put it like that. It makes a lot of sense now.

Sign In or Register to comment.