namespace zavai {
namespace bluetooth {
-public class Bluetooth: zavai.Service
+public class Bluetooth: zavai.ScriptService
{
public Bluetooth()
{
Object(name: "bluetooth");
+ started = script_status();
}
/// Start Bluetooth
public override void start()
{
if (started) return;
-
- try {
- // Then run our own script
- zavai.app.run_script(zavai.config.homedir + "/bluetooth start");
- } catch (Error e) {
- zavai.log.error("Running " + zavai.config.homedir + "/bluetooth start: " + e.message);
- return;
- }
-
+ if (!script_start()) return;
zavai.log.info("bluetooth turned on");
base.start();
}
public override void stop()
{
if (!started) return;
-
- try {
- zavai.app.run_script(zavai.config.homedir + "/bluetooth stop");
- } catch (Error e) {
- zavai.log.error("Running device stop bluetooth: " + e.message);
- }
+ script_stop();
base.stop();
}
}