iSense

From XennisWiki
Jump to: navigation, search

iApp

NeighborhoodMonitor

Dokumentation: isense::NeighborhoodMonitor Class Reference

Einbindung und Initialisierung

#include <isense/protocols/routing/neighborhood_monitor.h>

[...]

class iSenseDemoApplication :
	[...]
{
[...]
private:
	[...]
	NeighborhoodMonitor* nhm_;
};

[...]

iSenseDemoApplication::
iSenseDemoApplication(isense::Os& os) :
	isense::Application(os),
	nhm_(NULL)
{
}

[...]

void
iSenseDemoApplication::
boot()
{
	[...]
	nhm_ = new NeighborhoodMonitor(os());
}

Ausgabe der Adressen der Nachbarknoten

NeighborhoodMonitor::neighbor* neighbors = nhm_->get_neighbors(NeighborhoodMonitor::LAST_HEARD_TIME);
while(neighbors->addr != 0xFFFF) {
	os().debug("nhm %llu", neighbors->addr);
	*neighbors++;
}

UART

Dokumentation: isense::Uart Class Reference

Ausführliche Hilfe: iSense Serial Data Transmission User Guide

Einbindung und Initialisierung

#include <isense/uart.h>

[...]

class iSenseDemoApplication :
	public Application,
	public UartPacketHandler
{
public:
	[...]
	///From isense::UartPacketHandler
	virtual void handle_uart_packet(uint8, uint8*, uint16);
};

[...]

void
iSenseDemoApplication::
boot()
{
	/*
	 * Activate UART and set packet handler for type MESSAGE_TYPE_CUSTOM_IN_1
	 */
	Uart& uart = os().uart(0);
	uart.enable_interrupt(true);
	uart.set_packet_handler(Uart::MESSAGE_TYPE_CUSTOM_IN_1, this);
}

UART Packet können dann über die Methode handle_uart_packet empfangen werden.

void
iSenseDemoApplication::
handle_uart_packet(uint8 type, uint8* buf, uint16 length)
{
	os().debug("Uart type=%u, buf[0]=%u, length=%u", type, buf[0], length);
}

IShellInterpreter

siehe Verbindung von JShawn zur iShell

Siehe auch