{ \
return get_system_info_bool("tizen.org/feature/sensor.activity_recognition"); \
} \
+ static void submit_trigger_item() \
+ { \
+ context_manager::register_trigger_item((act_subj), OPS_SUBSCRIBE, \
+ "{\"Event\":{\"type\":\"string\", \"values\":[\"Detected\"]}}", \
+ "{\"Accuracy\":{\"type\":\"string\", \"values\":[\"Low\", \"Normal\", \"High\"]}}" \
+ ); \
+ } \
protected: \
void destroy_self() \
{ \
#define __CONTEXT_USER_ACTIVITY_TYPES_H__
// Subject
-#define USER_ACT_SUBJ_CYCLING "activity/event/cycling"
-#define USER_ACT_SUBJ_IN_VEHICLE "activity/event/in_vehicle"
-#define USER_ACT_SUBJ_RUNNING "activity/event/running"
-#define USER_ACT_SUBJ_STATIONARY "activity/event/stationary"
-#define USER_ACT_SUBJ_WALKING "activity/event/walking"
+#define USER_ACT_SUBJ_IN_VEHICLE "activity/in_vehicle"
+#define USER_ACT_SUBJ_RUNNING "activity/running"
+#define USER_ACT_SUBJ_STATIONARY "activity/stationary"
+#define USER_ACT_SUBJ_WALKING "activity/walking"
// Data Key
#define USER_ACT_EVENT "Event"
ctx::context_provider_info provider_info(provider::create, provider::destroy, NULL, privilege);
ctx::context_manager::register_provider(subject, provider_info);
+ provider::submit_trigger_item();
}
EXTAPI bool ctx::init_device_context_provider()
return true;
}
+void ctx::device_status_battery::submit_trigger_item()
+{
+ context_manager::register_trigger_item(DEVICE_ST_SUBJ_BATTERY, OPS_SUBSCRIBE | OPS_READ,
+ "{"
+ "\"Level\":{\"type\":\"string\",\"values\":[\"Empty\",\"Critical\",\"Low\",\"Normal\",\"High\",\"Full\"]},"
+ TRIG_BOOL_ITEM_DEF("IsCharging")
+ "}",
+ NULL);
+}
+
void ctx::device_status_battery::update_cb(device_callback_e device_type, void* value, void* user_data)
{
IF_FAIL_VOID(device_type == DEVICE_CALLBACK_BATTERY_LEVEL);
int unsubscribe();
int read();
static bool is_supported();
+ static void submit_trigger_item();
private:
device_status_battery();
#define __CONTEXT_DEVICESTATUS_TYPES_H__
// Subject
-#define DEVICE_ST_SUBJ_BATTERY "system/state/battery"
-#define DEVICE_ST_SUBJ_CHARGER "system/state/charger"
-#define DEVICE_ST_SUBJ_HEADPHONE "system/state/headphone"
-#define DEVICE_ST_SUBJ_WIFI "system/state/wifi"
-#define DEVICE_ST_SUBJ_USB "system/state/usb"
-#define DEVICE_ST_SUBJ_GPS "system/state/gps"
-#define DEVICE_ST_SUBJ_VIBRATION_MODE "system/state/vibration_mode"
-#define DEVICE_ST_SUBJ_PSMODE "system/state/ps_mode"
+#define DEVICE_ST_SUBJ_BATTERY "system/battery"
+#define DEVICE_ST_SUBJ_CHARGER "system/charger"
+#define DEVICE_ST_SUBJ_HEADPHONE "system/headphone"
+#define DEVICE_ST_SUBJ_WIFI "system/wifi"
+#define DEVICE_ST_SUBJ_USB "system/usb"
+#define DEVICE_ST_SUBJ_GPS "system/gps"
+#define DEVICE_ST_SUBJ_PSMODE "system/psmode"
// Data Key
#define DEVICE_ST_EVENT "Event"
#define DEVICE_ST_HEADSET "Headset"
#define DEVICE_ST_BLUETOOTH "Bluetooth"
+#define TRIG_BOOL_ITEM_DEF(sbj) "\"" sbj "\":{\"type\":\"integer\",\"min\":0,\"max\":1}"
+
#endif //__CONTEXT_DEVICESTATUS_TYPES_H__
return true;
}
+void ctx::device_status_headphone::submit_trigger_item()
+{
+ context_manager::register_trigger_item(DEVICE_ST_SUBJ_HEADPHONE, OPS_SUBSCRIBE | OPS_READ,
+ "{"
+ TRIG_BOOL_ITEM_DEF("IsConnected") ","
+ "\"Type\":{\"type\":\"string\",\"values\":[\"Normal\",\"Headset\",\"Bluetooth\"]}"
+ "}",
+ NULL);
+}
+
int ctx::device_status_headphone::subscribe()
{
connected = get_current_status();
int unsubscribe();
int read();
static bool is_supported();
+ static void submit_trigger_item();
private:
bool connected;
return true;
}
+void ctx::device_status_psmode::submit_trigger_item()
+{
+ context_manager::register_trigger_item(DEVICE_ST_SUBJ_PSMODE, OPS_SUBSCRIBE | OPS_READ,
+ "{" TRIG_BOOL_ITEM_DEF("IsEnabled") "}", NULL);
+}
+
void ctx::device_status_psmode::update_cb(keynode_t *node, void* user_data)
{
device_status_psmode *instance = static_cast<device_status_psmode*>(user_data);
int unsubscribe();
int read();
static bool is_supported();
+ static void submit_trigger_item();
private:
device_status_psmode();
return true;
}
+void ctx::device_status_charger::submit_trigger_item()
+{
+ context_manager::register_trigger_item(DEVICE_ST_SUBJ_CHARGER, OPS_SUBSCRIBE | OPS_READ,
+ "{" TRIG_BOOL_ITEM_DEF("IsConnected") "}", NULL);
+}
+
void ctx::device_status_charger::handle_update()
{
bool charger_status = false;
public:
int read();
static bool is_supported();
+ static void submit_trigger_item();
private:
device_status_charger();
return get_system_info_bool("tizen.org/feature/location.gps");
}
+void ctx::device_status_gps::submit_trigger_item()
+{
+ context_manager::register_trigger_item(DEVICE_ST_SUBJ_GPS, OPS_SUBSCRIBE | OPS_READ,
+ "{"
+ "\"State\":{\"type\":\"string\",\"values\":[\"Disabled\",\"Searching\",\"Connected\"]}"
+ "}",
+ NULL);
+}
+
void ctx::device_status_gps::handle_update()
{
int gps_status;
public:
int read();
static bool is_supported();
+ static void submit_trigger_item();
private:
device_status_gps();
return get_system_info_bool("tizen.org/feature/usb.host");
}
+void ctx::device_status_usb::submit_trigger_item()
+{
+ context_manager::register_trigger_item(DEVICE_ST_SUBJ_USB, OPS_SUBSCRIBE | OPS_READ,
+ "{" TRIG_BOOL_ITEM_DEF("IsConnected") "}", NULL);
+}
+
void ctx::device_status_usb::handle_update()
{
bool status = false;
public:
int read();
static bool is_supported();
+ static void submit_trigger_item();
private:
device_status_usb();
return get_system_info_bool("tizen.org/feature/network.wifi");
}
+void ctx::device_status_wifi::submit_trigger_item()
+{
+ context_manager::register_trigger_item(DEVICE_ST_SUBJ_WIFI, OPS_SUBSCRIBE | OPS_READ,
+ "{"
+ "\"State\":{\"type\":\"string\",\"values\":[\"Disabled\",\"Unconnected\",\"Connected\"]},"
+ "\"BSSID\":{\"type\":\"string\"}"
+ "}",
+ NULL);
+}
+
bool ctx::device_status_wifi::get_current_state()
{
int err;
int unsubscribe();
int read();
static bool is_supported();
+ static void submit_trigger_item();
private:
enum _state_e {
return get_system_info_bool("tizen.org/feature/network.telephony");
}
+void ctx::social_status_call::submit_trigger_item()
+{
+ context_manager::register_trigger_item(SOCIAL_ST_SUBJ_CALL, OPS_SUBSCRIBE | OPS_READ,
+ "{"
+ "\"Medium\":{\"type\":\"string\",\"values\":[\"Voice\",\"Video\"]},"
+ "\"State\":{\"type\":\"string\",\"values\":[\"Idle\",\"Connecting\",\"Connected\"]},"
+ "\"Address\":{\"type\":\"string\"}"
+ "}",
+ NULL);
+}
+
void ctx::social_status_call::call_event_cb(telephony_h handle, telephony_noti_e noti_id, void *data, void *user_data)
{
social_status_call *instance = static_cast<social_status_call*>(user_data);
int unsubscribe();
int read();
static bool is_supported();
+ static void submit_trigger_item();
private:
telephony_handle_list_s handle_list;
return get_system_info_bool("tizen.org/feature/network.telephony");
}
+void ctx::social_status_email::submit_trigger_item()
+{
+ context_manager::register_trigger_item(SOCIAL_ST_SUBJ_EMAIL, OPS_SUBSCRIBE,
+ "{"
+ "\"Event\":{\"type\":\"string\",\"values\":[\"Received\",\"Sent\"]}"
+ "}",
+ NULL);
+}
+
void ctx::social_status_email::on_signal_received(const char* sender, const char* path, const char* iface, const char* name, GVariant* param)
{
gint sub_type = 0;
int unsubscribe();
void on_signal_received(const char* sender, const char* path, const char* iface, const char* name, GVariant* param);
static bool is_supported();
+ static void submit_trigger_item();
private:
int64_t dbus_signal_id;
return get_system_info_bool("tizen.org/feature/network.telephony");
}
+void ctx::social_status_message::submit_trigger_item()
+{
+ context_manager::register_trigger_item(SOCIAL_ST_SUBJ_MESSAGE, OPS_SUBSCRIBE,
+ "{"
+ "\"Event\":{\"type\":\"string\",\"values\":[\"Received\"]},"
+ "\"Type\":{\"type\":\"string\",\"values\":[\"SMS\",\"MMS\"]},"
+ "\"Address\":{\"type\":\"string\"}"
+ "}",
+ NULL);
+}
+
void ctx::social_status_message::state_change_cb(msg_handle_t handle, msg_struct_t msg, void* user_data)
{
social_status_message *instance = static_cast<social_status_message*>(user_data);
int subscribe();
int unsubscribe();
static bool is_supported();
+ static void submit_trigger_item();
private:
msg_handle_t message_handle;
#define __CONTEXT_SOCIAL_STATUS_TYPES_INTERNAL_H__
// Subject
-#define SOCIAL_ST_SUBJ_CALL "social/state/call"
-#define SOCIAL_ST_SUBJ_EMAIL "social/event/email"
-#define SOCIAL_ST_SUBJ_MESSAGE "social/event/message"
+#define SOCIAL_ST_SUBJ_CALL "social/call"
+#define SOCIAL_ST_SUBJ_EMAIL "social/email"
+#define SOCIAL_ST_SUBJ_MESSAGE "social/message"
// Data Key
#define SOCIAL_ST_STATE "State"