Beispiel #1
0
static void
nglmi_startup(sc_p sc)
{
	sc->remote_seq = 0;
	sc->local_seq = 1;
	sc->seq_retries = 0;
	sc->livs = sc->liv_per_full - 1;
	/* start off the ticker in 1 sec */
	ng_callout(&sc->handle, sc->node, NULL, hz, LMI_ticker, NULL, 0);
}
Beispiel #2
0
/*
 * We have just attached to a live (we hope) node.
 * Fire out a LMI inquiry, and then start up the timers.
 */
static void
LMI_ticker(node_p node, hook_p hook, void *arg1, int arg2)
{
	sc_p sc = NG_NODE_PRIVATE(node);

	if (sc->flags & SCF_AUTO) {
		ngauto_state_machine(sc);
		ng_callout(&sc->handle, node, NULL, NG_LMI_POLL_RATE * hz,
		    LMI_ticker, NULL, 0);
	} else {
		if (sc->livs++ >= sc->liv_per_full) {
			nglmi_inquire(sc, 1);
			/* sc->livs = 0; *//* do this when we get the answer! */
		} else {
			nglmi_inquire(sc, 0);
		}
		ng_callout(&sc->handle, node, NULL, sc->liv_rate * hz,
		    LMI_ticker, NULL, 0);
	}
}
int
ng_hci_command_timeout(ng_hci_unit_p unit)
{
	if (unit->state & NG_HCI_UNIT_COMMAND_PENDING)
		panic(
"%s: %s - Duplicated command timeout!\n", __func__, NG_NODE_NAME(unit->node));

	unit->state |= NG_HCI_UNIT_COMMAND_PENDING;
	ng_callout(&unit->cmd_timo, unit->node, NULL,
				bluetooth_hci_command_timeout(),
				ng_hci_process_command_timeout, NULL, 0);

	return (0);
} /* ng_hci_command_timeout */
int
ng_hci_con_timeout(ng_hci_unit_con_p con)
{
	if (con->flags & NG_HCI_CON_TIMEOUT_PENDING)
		panic(
"%s: %s - Duplicated connection timeout!\n",
			__func__, NG_NODE_NAME(con->unit->node));

	con->flags |= NG_HCI_CON_TIMEOUT_PENDING;
	ng_callout(&con->con_timo, con->unit->node, NULL,
				bluetooth_hci_connect_timeout(),
				ng_hci_process_con_timeout, NULL,
				con->con_handle);

	return (0);
} /* ng_hci_con_timeout */