Пример #1
0
static void send_usb_state_ind(const char* usb_state)
{
  DBusMessage* usb_state_ind_msg = dbus_message_new_signal("/com/meego/usb_moded", "com.meego.usb_moded", "sig_usb_state_ind");

  dbus_message_append_args(usb_state_ind_msg,
                           DBUS_TYPE_STRING, &usb_state);

  dsme_dbus_stub_send_signal(usb_state_ind_msg);
  free(usb_state_ind_msg);
}
static void send_call_state_ind(const char* call_state)
{
  DBusMessage* call_state_ind_msg = dbus_message_new_signal("/com/nokia/mce", "com.nokia.mce.signal", "sig_call_state_ind");

  dbus_message_append_args(call_state_ind_msg,
                           DBUS_TYPE_STRING, &call_state);

  dsme_dbus_stub_send_signal(call_state_ind_msg);
  free(call_state_ind_msg);
}
Пример #3
0
/* Set alarm with com.nokia.time dbus interface */
static void test_init_set_alarm_in5min(void)
{
  load_alarmtracker(0);

  DBusMessage* alarm_setup_msg = dbus_message_new_signal("/com/nokia/time", "com.nokia.time", "next_bootup_event");

  time_t new_alarm_time = time(0)+300;
  dbus_message_append_args(alarm_setup_msg,
                           DBUS_TYPE_INT32, &new_alarm_time);

  dsme_dbus_stub_send_signal(alarm_setup_msg);
  free(alarm_setup_msg);

  assert(!message_queue_is_empty());
  assert(queued(DSM_MSGTYPE_WAIT));
  assert(message_queue_is_empty());

  DSM_MSGTYPE_WAKEUP wakeupmsg =
      TEST_MSG_INIT(DSM_MSGTYPE_WAKEUP);
  send_message(alarmtracker_module, &wakeupmsg);


  /* INTERNAL MSGs */
  DSM_MSGTYPE_SET_ALARM_STATE *msg;
  assert(message_queue_is_empty());

  /* DBUS IF */
  assert(dbusmsgq_async->len == 0);
  assert(dbusmsgq_blocking->len == 0);

  /* DSMESOCK */
  assert((msg = queued_dsmesock(DSM_MSGTYPE_SET_ALARM_STATE)));
  assert(msg->alarm_set);
  free(msg);
  assert(g_slist_length(dsmesock_broadcasts)==0);

  assert(timer_exists());
  sumtime(first_timer_seconds());
  trigger_timer();

  assert(!message_queue_is_empty());
  assert((msg = queued(DSM_MSGTYPE_SET_ALARM_STATE)));
  assert(msg->alarm_set);
  free(msg);
  assert(dbusmsgq_async->len == 0);
  assert(dbusmsgq_blocking->len == 0);
  assert(g_slist_length(dsmesock_broadcasts)==0);

  assert(!timer_exists());

  unload_alarmtracker();
}