Example #1
0
/********************
 * hold
 ********************/
static int
hold(call_t *call, int status)
{
    DBusMessage *msg;
    const char  *name, *path, *iface, *method;
    dbus_bool_t  held = status;
    
    path   = call->path;
    iface  = TP_INTERFACE_HOLD;
    method = TP_HOLD;
    msg    = dbus_message_new_method_call(NULL, path, iface, method);

    if (msg == NULL) {
        OHM_ERROR("Failed to allocate D-BUS Hold message.");
        return ENOMEM;
    }
    
    if (!dbus_message_append_args(msg, DBUS_TYPE_BOOLEAN, &held,
                                  DBUS_TYPE_INVALID)) {
        OHM_ERROR("Failed to create D-BUS Hold message.");
        dbus_message_unref(msg);
        return EINVAL;
    }

    return bus_send(msg, NULL) ? 0 : EIO;
}
Example #2
0
void bus_send_string(char *buf)
{
	u16 i;
	CPU_SR_ALLOC();
	
	OS_CRITICAL_ENTER_CPU_CRITICAL_EXIT();
	for (i = 0; buf[i] != '\0'; i++)
		bus_send(&buf[i], 1);
	OS_CRITICAL_EXIT();
}
Example #3
0
File: timer.c Project: sswly/sos
void timer_schedule(void *ctx, 
    void *(*run)(void *), size_t interval, size_t loop_time)
{
    plan_task_t *task = calloc(1, sizeof(plan_task_t));
    task->run = run;
    task->interval = interval;
    task->tick = interval;
    task->loop_time = loop_time;
    
    timer_ctx_t *fctx = ctx;
    bus_send(fctx->bus, &job);
}
Example #4
0
s8 send_data(u32 ip, u16 src_port, u16 dst_port, char *data, u16 len)
{

	u8 id = get_id(ip, src_port, dst_port);
	
	sprintf(temp, "AT+CIPSEND=%d,%d\r\n", id, len);
	
	bus_send_string(temp);
	
	msleep(20);
	
	bus_recieve_string(output);
	
	if (str_include(output, ">") == 0) {
		bus_send(data, len);
		return 0;
	} else
		return -1;
}