static char cycle_time[MENU_DATA_SIZE + 1] = {"900", }; /**< cycle time */
static char window[MENU_DATA_SIZE + 1] = {"60", }; /**< Detection window */
-static char g_presence_and_cond[MENU_DATA_SIZE + 1] = {0,}; /**< PRESENCE AND condition */
-static char g_presence_or_cond[MENU_DATA_SIZE + 1] = {0,}; /**< PRESENCE OR condition */
-static char g_absence_and_cond[MENU_DATA_SIZE + 1] = {0,}; /**< ABSENCE AND condition */
-static char g_absence_or_cond[MENU_DATA_SIZE + 1] = {0,}; /**< ABSENCE OR condition */
-static char g_conjunction_op[MENU_DATA_SIZE + 1] = {"1",}; /**< logical conjunction operation */
-
-static char g_presence_type[MENU_DATA_SIZE + 1] = "2"; /**< Selected PRESENCE type */
-static char g_absence_type[MENU_DATA_SIZE + 1] = "2"; /**< Selected ABSENCE type */
+static char g_presence_and_cond[MENU_DATA_SIZE + 1] = {"16",}; /**< PRESENCE AND condition */
+static char g_presence_or_cond[MENU_DATA_SIZE + 1] = {"6",}; /**< PRESENCE OR condition */
+static char g_presence_conjunction_op[MENU_DATA_SIZE + 1] = {"1",}; /**< logical conjunction operation */
+static char g_absence_and_cond[MENU_DATA_SIZE + 1] = {"6",}; /**< ABSENCE AND condition */
+static char g_absence_or_cond[MENU_DATA_SIZE + 1] = {"16",}; /**< ABSENCE OR condition */
+static char g_absence_conjunction_op[MENU_DATA_SIZE + 1] = {"0",}; /**< logical conjunction operation */
+
+static char g_presence_type[MENU_DATA_SIZE + 1] = "1"; /**< Selected PRESENCE type */
+static char g_absence_type[MENU_DATA_SIZE + 1] = "1"; /**< Selected ABSENCE type */
static char g_scan_time_multiplier[MENU_DATA_SIZE + 1] = {0,}; /**< 10ms * what number */
static void __device_presence_detected_cb(int result, ua_monitor_h monitor,
bitmask_and = (unsigned int)strtol(g_presence_and_cond, NULL, 10);
if (strlen(g_presence_or_cond))
bitmask_or = (unsigned int)strtol(g_presence_or_cond, NULL, 10);
- if (strlen(g_conjunction_op))
- op_value = (unsigned int)strtol(g_conjunction_op, NULL, 10);
+ if (strlen(g_presence_conjunction_op))
+ op_value = (unsigned int)strtol(g_presence_conjunction_op, NULL, 10);
conjunction_op = op_value ? UA_AND_OPERATION : UA_OR_OPERATION;
msgb("AND [%u] [%s] OR [%u]", bitmask_and, op_value ? "and" : "or",
bitmask_or);
- ret = ua_monitor_set_user_presence_condition(g_ua_mon_h, bitmask_and, bitmask_or, conjunction_op);
+ ret = ua_monitor_set_user_presence_condition(g_ua_mon_h,
+ bitmask_and, bitmask_or, conjunction_op);
msg(" - ua_monitor_set_user_presence_condition() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
bitmask_and = (unsigned int)strtol(g_absence_and_cond, NULL, 10);
if (strlen(g_absence_or_cond))
bitmask_or = (unsigned int)strtol(g_absence_or_cond, NULL, 10);
- if (strlen(g_conjunction_op))
- op_value = (unsigned int)strtol(g_conjunction_op, NULL, 10);
+ if (strlen(g_absence_conjunction_op))
+ op_value = (unsigned int)strtol(g_absence_conjunction_op, NULL, 10);
conjunction_op = op_value ? UA_AND_OPERATION : UA_OR_OPERATION;
MManager *mm, struct menu_data *menu)
{
int ret = UA_ERROR_NONE;
+ unsigned int bitmask_and = 0;
+ unsigned int bitmask_or = 0;
+ unsigned int op_value = 1;
+ ua_condition_conjunction_e conjunction_op = UA_AND_OPERATION;
msg("ua_monitor_start_presence_detection");
check_if(NULL == g_ua_mon_h);
+ if (strlen(g_presence_and_cond))
+ bitmask_and = (unsigned int)strtol(g_presence_and_cond, NULL, 10);
+ if (strlen(g_presence_or_cond))
+ bitmask_or = (unsigned int)strtol(g_presence_or_cond, NULL, 10);
+ if (strlen(g_presence_conjunction_op))
+ op_value = (unsigned int)strtol(g_presence_conjunction_op, NULL, 10);
+
+ conjunction_op = op_value ? UA_AND_OPERATION : UA_OR_OPERATION;
+
+ msgb("AND [%u] [%s] OR [%u]", bitmask_and, op_value ? "and" : "or",
+ bitmask_or);
+
+ ret = ua_monitor_set_user_presence_condition(g_ua_mon_h,
+ bitmask_and, bitmask_or, conjunction_op);
+
if (strlen(g_presence_type))
detection_mode = (unsigned char)strtol(g_presence_type, NULL, 10);
{
int ret = UA_ERROR_NONE;
- msg("ua_monitor_start_absence_detection");
+ unsigned int bitmask_and = 0;
+ unsigned int bitmask_or = 0;
+ unsigned int op_value = 1;
+ ua_condition_conjunction_e conjunction_op = UA_AND_OPERATION;
- ua_detection_mode_e detection_mode = UA_DETECT_MODE_INVALID;
+ msg("ua_monitor_start_absence_detection");
check_if(NULL == g_ua_mon_h);
+ if (strlen(g_absence_and_cond))
+ bitmask_and = (unsigned int)strtol(g_absence_and_cond, NULL, 10);
+ if (strlen(g_absence_or_cond))
+ bitmask_or = (unsigned int)strtol(g_absence_or_cond, NULL, 10);
+ if (strlen(g_absence_conjunction_op))
+ op_value = (unsigned int)strtol(g_absence_conjunction_op, NULL, 10);
+
+ conjunction_op = op_value ? UA_AND_OPERATION : UA_OR_OPERATION;
+
+ msgb("AND [%u] [%s] OR [%u]", bitmask_and, op_value ? "and" : "or",
+ bitmask_or);
+
+ ret = ua_monitor_set_user_absence_condition(g_ua_mon_h,
+ bitmask_and, bitmask_or, conjunction_op);
+
+ ua_detection_mode_e detection_mode = UA_DETECT_MODE_INVALID;
+
if (strlen(g_absence_type))
detection_mode = (unsigned char)strtol((g_absence_type), NULL, 10);
msgr("Fail to request power off");
return false;
}
-#if 0
+
ret = device_power_set_wakeup_reason(POWER_WAKEUP_REASON_REMOTE_CONTROLLER);
if(POWER_ERROR_NONE != device_power_set_wakeup_reason(POWER_WAKEUP_REASON_REMOTE_CONTROLLER))
{
msgr("Failed to request TV to STANDBY!");
return RET_SUCCESS;
}
-#endif
+
msg(" - run_device_power_request_poweroff() ret: [0x%X] [%s]",
ret, uat_get_error_str(ret));
{ "2", "OR Bitmask (1:BT 2:BLE 4:Wi-Fi 8:Motion 16:Light 32:Audio)",
NULL, NULL, g_presence_or_cond },
{ "3", "logical conjunction operation(0:OR, 1:AND)",
- NULL, NULL, g_conjunction_op },
+ NULL, NULL, g_presence_conjunction_op },
{ "4", "run", NULL,
run_ua_monitor_set_user_presence_condition, NULL },
{ NULL, NULL, },
{ "2", "OR Bitmask (1:BT 2:BLE 4:Wi-Fi 8:Motion 16:Light 32:Audio)",
NULL, NULL, g_absence_or_cond },
{ "3", "logical conjunction operation(0:OR, 1:AND)",
- NULL, NULL, g_conjunction_op },
+ NULL, NULL, g_absence_conjunction_op },
{ "4", "run", NULL,
run_ua_monitor_set_user_absence_condition, NULL },
{ NULL, NULL, },
};
static struct menu_data menu_ua_start_presence[] = {
- { "1", "type (1:ALL 2:ANY)", NULL, NULL, g_presence_type },
- { "2", "service(empty for default, else selected service)", NULL, NULL, g_service_str},
- { "3", "run", NULL, run_ua_monitor_start_presence_detection, NULL },
+ { "1", "AND (1:BT 2:BLE 4:Wi-Fi 8:Motion 16:Light 32:Audio)",
+ NULL, NULL, g_presence_and_cond },
+ { "2", "OR (1:BT 2:BLE 4:Wi-Fi 8:Motion 16:Light 32:Audio)",
+ NULL, NULL, g_presence_or_cond },
+ { "3", "[1] cond. [2] (0:OR, 1:AND)",
+ NULL, NULL, g_presence_conjunction_op },
+ { "4", "type (1:ALL 2:ANY)",
+ NULL, NULL, g_presence_type },
+ { "5", "service(empty for default, else selected service)",
+ NULL, NULL, g_service_str},
+ { "6", "run",
+ NULL, run_ua_monitor_start_presence_detection, NULL },
{ NULL, NULL, },
};
static struct menu_data menu_ua_start_absence[] = {
- { "1", "type (1:ALL 2:ANY)", NULL, NULL, g_absence_type },
- { "2", "service(empty for default, else selected service)", NULL, NULL, g_service_str},
- { "3", "run", NULL, run_ua_monitor_start_absence_detection, NULL },
+ { "1", "AND (1:BT 2:BLE 4:Wi-Fi 8:Motion 16:Light 32:Audio)",
+ NULL, NULL, g_absence_and_cond },
+ { "2", "OR (1:BT 2:BLE 4:Wi-Fi 8:Motion 16:Light 32:Audio)",
+ NULL, NULL, g_absence_or_cond },
+ { "3", "[1] cond. [2] ( 0:OR, 1:AND)",
+ NULL, NULL, g_absence_conjunction_op },
+ { "4", "type (1:ALL 2:ANY)",
+ NULL, NULL, g_absence_type },
+ { "5", "service(empty for default, else selected service)",
+ NULL, NULL, g_service_str},
+ { "6", "run",
+ NULL, run_ua_monitor_start_absence_detection, NULL },
{ NULL, NULL, },
};
static struct menu_data menu_start_absence_presence[] = {
- { "1", "ABSENCE detection type (1:ALL 2:ANY)", NULL, NULL, g_absence_type },
- { "2", "PRESENCE detection type (1:ALL 2:ANY)", NULL, NULL, g_presence_type },
- { "3", "start", NULL, run_ua_monitor_start_absence_presence, NULL },
- { "4", "stop", NULL, run_ua_monitor_stop_absence_presence, NULL },
+ { "1", "ABSENCE detection type (1:ALL 2:ANY)",
+ NULL, NULL, g_absence_type },
+ { "2", "PRESENCE detection type (1:ALL 2:ANY)",
+ NULL, NULL, g_presence_type },
+ { "3", "start",
+ NULL, run_ua_monitor_start_absence_presence, NULL },
+ { "4", "stop",
+ NULL, run_ua_monitor_stop_absence_presence, NULL },
{ NULL, NULL, },
};