package com.neptune.plugin;

import com.getcapacitor.JSObject;
import com.getcapacitor.PluginCall;
import com.neptune.modules.Phone;
import com.neptune.plugin.models.SignalInfoModel;
import com.neptune.utils.MyLog;

public class NeptunePhoneHandler {

    private static final long SIGNAL_TIMEOUT = 1500;

    public static void getSignalInfo(PluginCall call) {
        MyLog.logI("Starting getSignalInfo");
        JSObject ret = new JSObject();
        try {
            SignalInfoModel info = Phone.getInstance().getSignalInfo(SIGNAL_TIMEOUT);
            ret.put("value", info.toJSON());
            call.success(ret);
        }catch(Exception e){
            MyLog.logE(e.getMessage());
            call.reject(e.getMessage(), e);
        }
    }
}
