void telephony_service_network_status_changed_notify(struct telephony_service *service, struct telephony_network_status *net_status) { jvalue_ref reply_obj = NULL; jvalue_ref network_obj = NULL; if (service->power_off_pending) return; reply_obj = jobject_create(); network_obj = jobject_create(); jobject_put(reply_obj, J_CSTR_TO_JVAL("returnValue"), jboolean_create(true)); jobject_put(reply_obj, J_CSTR_TO_JVAL("errorCode"), jnumber_create_i32(0)); jobject_put(reply_obj, J_CSTR_TO_JVAL("errorText"), jstring_create("")); service->network_registered = (net_status->state == TELEPHONY_NETWORK_STATE_SERVICE); jobject_put(network_obj, J_CSTR_TO_JVAL("state"), jstring_create(telephony_network_state_to_string(net_status->state))); jobject_put(network_obj, J_CSTR_TO_JVAL("registration"), jstring_create(telephony_network_registration_to_string(net_status->registration))); jobject_put(network_obj, J_CSTR_TO_JVAL("networkName"), jstring_create(net_status->name != NULL ? net_status->name : "")); jobject_put(network_obj, J_CSTR_TO_JVAL("causeCode"), jstring_create("")); jobject_put(reply_obj, J_CSTR_TO_JVAL("eventNetwork"), network_obj); luna_service_post_subscription(service->private_service, "/", "networkStatusQuery", reply_obj); j_release(&reply_obj); }
static void notify_status_subscribers(struct audio_service *service) { jvalue_ref reply_obj = NULL; reply_obj = jobject_create(); jobject_put(reply_obj, J_CSTR_TO_JVAL("volume"), jnumber_create_f64(service->volume)); jobject_put(reply_obj, J_CSTR_TO_JVAL("mute"), jboolean_create(service->mute)); jobject_put(reply_obj, J_CSTR_TO_JVAL("returnValue"), jboolean_create(true)); luna_service_post_subscription(service->handle, "/", "getStatus", reply_obj); j_release(&reply_obj); }
void telephony_service_signal_strength_changed_notify(struct telephony_service *service, int bars) { jvalue_ref reply_obj = NULL; jvalue_ref signal_obj = NULL; if (service->power_off_pending) return; reply_obj = jobject_create(); signal_obj = jobject_create(); jobject_put(reply_obj, J_CSTR_TO_JVAL("returnValue"), jboolean_create(true)); jobject_put(reply_obj, J_CSTR_TO_JVAL("errorCode"), jnumber_create_i32(0)); jobject_put(reply_obj, J_CSTR_TO_JVAL("errorText"), jstring_create("")); jobject_put(signal_obj, J_CSTR_TO_JVAL("bars"), jnumber_create_i32(bars)); jobject_put(reply_obj, J_CSTR_TO_JVAL("eventSignal"), signal_obj); luna_service_post_subscription(service->private_service, "/", "signalStrengthQuery", reply_obj); j_release(&reply_obj); }
void telephony_service_power_status_notify(struct telephony_service *service, bool power) { jvalue_ref reply_obj = NULL; jvalue_ref extended_obj = NULL; service->powered = power; if (!service->initialized) { g_message("Service not yet successfully initialized. Not sending power status notification"); return; } reply_obj = jobject_create(); jobject_put(reply_obj, J_CSTR_TO_JVAL("returnValue"), jboolean_create(true)); extended_obj = jobject_create(); jobject_put(extended_obj, J_CSTR_TO_JVAL("powerState"), jstring_create(power ? "on": "off")); jobject_put(reply_obj, J_CSTR_TO_JVAL("extended"), extended_obj); luna_service_post_subscription(service->private_service, "/", "powerQuery", reply_obj); j_release(&reply_obj); }