示例#1
0
void ppp_set_recv_accm(GAtPPP *ppp, guint32 accm)
{
	g_at_hdlc_set_recv_accm(ppp->hdlc, accm);
}
示例#2
0
int main(int argc, char **argv)
{
	GOptionContext *context;
	GError *err = NULL;
	GIOChannel *channel;
	GAtHDLC *hdlc;

	context = g_option_context_new(NULL);
	g_option_context_add_main_entries(context, options, NULL);

	if (g_option_context_parse(context, &argc, &argv, &err) == FALSE) {
		if (err != NULL) {
			g_printerr("%s\n", err->message);
			g_error_free(err);
			return 1;
		}

		g_printerr("An unknown error occurred\n");
		return 1;
	}

	g_option_context_free(context);

	if (option_device == NULL)
		option_device = g_strdup("/dev/ttyUSB1");

	g_print("Device: %s\n", option_device);

	channel = g_at_tty_open_qcdm(option_device);
	if (channel == NULL) {
		g_printerr("Failed to open QCDM device\n");
		return 1;
	}

	event_loop = g_main_loop_new(NULL, FALSE);

	hdlc = g_at_hdlc_new(channel);

	g_io_channel_unref(channel);

	if (hdlc == NULL)
		return 1;

	if (option_debug == TRUE)
		g_at_hdlc_set_debug(hdlc, hdlc_debug, "HDLC");

	g_at_hdlc_set_xmit_accm(hdlc, 0);
	g_at_hdlc_set_recv_accm(hdlc, 0);

	g_at_hdlc_set_receive(hdlc, hdlc_receive, NULL);

	send_command(hdlc, 0x00);	/* Version info */
	send_command(hdlc, 0x51);	/* Features query */

	send_subsys_command(hdlc, 250, 7);	/* Novatel modem status */

	g_main_loop_run(event_loop);

	g_at_hdlc_unref(hdlc);

	g_main_loop_unref(event_loop);

	g_free(option_device);

	return 0;
}