Example #1
0
File: stk.c Project: yongsu/oFono
static void send_sms_submit_cb(gboolean ok, void *data)
{
	struct sms_submit_req *req = data;
	struct ofono_stk *stk = req->stk;
	struct ofono_error failure = { .type = OFONO_ERROR_TYPE_FAILURE };
	struct stk_response rsp;

	ofono_debug("SMS submission %s", ok ? "successful" : "failed");

	if (req->cancelled) {
		ofono_debug("Received an SMS submitted callback after the "
				"proactive command was cancelled");
		return;
	}

	memset(&rsp, 0, sizeof(rsp));

	if (ok == FALSE)
		rsp.result.type = STK_RESULT_TYPE_NETWORK_UNAVAILABLE;

	if (stk_respond(stk, &rsp, stk_command_cb))
		stk_command_cb(&failure, stk);

	if (stk->pending_cmd->send_sms.alpha_id &&
			stk->pending_cmd->send_sms.alpha_id[0])
		stk_alpha_id_unset(stk);
}
Example #2
0
static void example_history_call_missed(struct ofono_history_context *context,
					const struct ofono_call *call,
					time_t when)
{
	const char *from = "Unknown";
	char buf[128];

	ofono_debug("Call Missed on modem: %p", context->modem);

	if (call->type != 0)
		return;

	ofono_debug("Voice Call, %s",
			call->direction ? "Incoming" : "Outgoing");

	if (call->clip_validity == 0)
		from = phone_number_to_string(&call->phone_number);

	ofono_debug("From: %s", from);

	if (call->cnap_validity == 0)
		ofono_debug("Name from Network: %s\n", call->name);

	strftime(buf, 127, "%Y-%m-%dT%H:%M:%S%z", localtime(&when));
	buf[127] = '\0';
	ofono_debug("When: %s", buf);
}
Example #3
0
static void example_history_sms_send_pending(struct ofono_history_context *context,
						const struct ofono_uuid *uuid,
						const char *to, time_t when,
						const char *text)
{
	char buf[128];

	ofono_debug("Sending SMS on modem: %p", context->modem);
	ofono_debug("InternalMessageId: %s", ofono_uuid_to_str(uuid));
	ofono_debug("To: %s:", to);

	strftime(buf, 127, "%Y-%m-%dT%H:%M:%S%z", localtime(&when));
	buf[127] = '\0';
	ofono_debug("Local Time: %s", buf);
	ofono_debug("Text: %s", text);
}
Example #4
0
File: stk.c Project: yongsu/oFono
static void session_agent_notify(gpointer user_data)
{
	struct ofono_stk *stk = user_data;

	ofono_debug("Session Agent removed");

	if (stk->current_agent == stk->session_agent && agent_called(stk)) {
		ofono_debug("Sending Terminate response for session agent");
		send_simple_response(stk, STK_RESULT_TYPE_USER_TERMINATED);
	}

	stk->session_agent = NULL;
	stk->current_agent = stk->default_agent;

	if (stk->remove_agent_source) {
		g_source_remove(stk->remove_agent_source);
		stk->remove_agent_source = 0;
	}
}
Example #5
0
static int example_provision_get_settings(const char *mcc, const char *mnc,
				const char *spn,
				const char *imsi, const char *gid1,
				struct ofono_gprs_provision_data **settings,
				int *count)
{
	ofono_debug("Provisioning...");
	*count = 0;
	*settings = NULL;

	ofono_info("Provisioning for MCC %s, MNC %s, SPN '%s', IMSI '%s', "
			"GID1 '%s'", mcc, mnc, spn, imsi, gid1);

	if (strcmp(mcc, "246") != 0 || strcmp(mnc, "81") != 0 ||
						g_strcmp0(spn, "oFono") != 0)
		return -ENOENT;

	ofono_debug("Creating example settings for phonesim");

	*settings = g_try_new0(struct ofono_gprs_provision_data, 2);
	if (*settings == NULL)
		return -ENOMEM;

	*count = 2;

	/* Internet context settings */
	(*settings)[0].proto = OFONO_GPRS_PROTO_IP;
	(*settings)[0].type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
	(*settings)[0].name = g_strdup("Phonesim Internet");
	(*settings)[0].apn = g_strdup("internetapn");

	/* MMS context settings */
	(*settings)[1].proto = OFONO_GPRS_PROTO_IP;
	(*settings)[1].type = OFONO_GPRS_CONTEXT_TYPE_MMS;
	(*settings)[1].name = g_strdup("Phonesim MMS");
	(*settings)[1].apn = g_strdup("mmsapn");
	(*settings)[1].username = g_strdup("mmsuser");
	(*settings)[1].password = g_strdup("mmspass");
	(*settings)[1].message_proxy = g_strdup("10.11.12.13:8080");
	(*settings)[1].message_center = g_strdup("http://mms.example.com:8000");

	return 0;
}
Example #6
0
static void example_history_sms_send_status(
					struct ofono_history_context *context,
					const struct ofono_uuid *uuid,
					time_t when,
					enum ofono_history_sms_status s)
{
	char buf[128];

	strftime(buf, 127, "%Y-%m-%dT%H:%M:%S%z", localtime(&when));
	buf[127] = '\0';

	switch (s) {
	case OFONO_HISTORY_SMS_STATUS_PENDING:
		break;
	case OFONO_HISTORY_SMS_STATUS_SUBMITTED:
		ofono_debug("SMS %s submitted successfully",
					ofono_uuid_to_str(uuid));
		ofono_debug("Submission Time: %s", buf);
		break;
	case OFONO_HISTORY_SMS_STATUS_SUBMIT_FAILED:
		ofono_debug("Sending SMS %s failed", ofono_uuid_to_str(uuid));
		ofono_debug("Failure Time: %s", buf);
		break;
	case OFONO_HISTORY_SMS_STATUS_SUBMIT_CANCELLED:
		ofono_debug("Submission of SMS %s was canceled",
					ofono_uuid_to_str(uuid));
		ofono_debug("Cancel time: %s", buf);
		break;
	case OFONO_HISTORY_SMS_STATUS_DELIVERED:
		ofono_debug("SMS delivered, msg_id: %s, time: %s",
					ofono_uuid_to_str(uuid), buf);
		break;
	case OFONO_HISTORY_SMS_STATUS_DELIVER_FAILED:
		ofono_debug("SMS undeliverable, msg_id: %s, time: %s",
					ofono_uuid_to_str(uuid), buf);
		break;
	default:
		break;
	}
}
Example #7
0
File: ril.c Project: CODeRUS/ofono
static void ril_connected(struct ril_msg *message, gpointer user_data)
{
	DBG("");

	struct ofono_modem *modem = (struct ofono_modem *) user_data;
	struct ril_data *ril = ofono_modem_get_data(modem);
	int ril_version = 0;
	struct parcel rilp;

	ril_util_init_parcel(message, &rilp);
	ril_version = parcel_r_int32(&rilp);
	ofono_debug("%s: [UNSOL]< %s, RIL_VERSION %d",
			__func__, ril_unsol_request_to_string(message->req),
			ril_version);

	ril->connected = TRUE;

	send_get_sim_status(modem);

	connection = ofono_dbus_get_connection();
	mce_daemon_watch = g_dbus_add_service_watch(connection, MCE_SERVICE,
				mce_connect, mce_disconnect, modem, NULL);
}
Example #8
0
static void example_history_sms_received(struct ofono_history_context *context,
						const struct ofono_uuid *uuid,
						const char *from,
						const struct tm *remote,
						const struct tm *local,
						const char *text)
{
	char buf[128];

	ofono_debug("Incoming SMS on modem: %p", context->modem);
	ofono_debug("InternalMessageId: %s", ofono_uuid_to_str(uuid));
	ofono_debug("From: %s", from);

	strftime(buf, 127, "%Y-%m-%dT%H:%M:%S%z", local);
	buf[127] = '\0';
	ofono_debug("Local Sent Time: %s", buf);

	strftime(buf, 127, "%Y-%m-%dT%H:%M:%S%z", remote);
	buf[127] = '\0';
	ofono_debug("Remote Sent Time: %s", buf);

	ofono_debug("Text: %s", text);
}
Example #9
0
static void example_history_remove(struct ofono_history_context *context)
{
	ofono_debug("Example History Remove for modem: %p", context->modem);
}
Example #10
0
static int example_history_probe(struct ofono_history_context *context)
{
	ofono_debug("Example History Probe for modem: %p", context->modem);
	return 0;
}
Example #11
0
static void sms_history_remove(struct ofono_history_context *context)
{
	ofono_debug("SMS History Remove for modem: %p", context->modem);
}