Ejemplo n.º 1
0
GBeeError gbeeSendTxRequest(GBee *self, uint8_t frameId, uint32_t dstAddr64h, 
		uint32_t dstAddr64l, uint16_t dstAddr16, uint8_t bcastRadius,
		uint8_t options, uint8_t *data, uint16_t length) {

	// Error code returned by GBee.
	GBeeError error = GBEE_NO_ERROR;
	// 16bit address Tx request parameters.
	GBeeTxRequest txRequest;

	// Check some pre-conditions.
	if (self->lastError != GBEE_NO_ERROR)
	{
		error = GBEE_INHERITED_ERROR;
	}
	GBEE_THROW(error);

	// Assemble the AT command frame.
	txRequest.ident      = GBEE_TX_REQUEST;
	txRequest.frameId    = frameId;
	txRequest.dstAddr64h = GBEE_ULONG(dstAddr64h);
	txRequest.dstAddr64l = GBEE_ULONG(dstAddr64l);
	txRequest.dstAddr16  = GBEE_USHORT(dstAddr16);
	txRequest.bcastRadius = bcastRadius;
	txRequest.options    = options;
	GBEE_PORT_MEMORY_COPY(txRequest.data, data, length);

	// Send the AT command frame.
	error = gbeeSend(self, (GBeeFrameData *)&txRequest, length + GBEE_TX_REQUEST_HEADER_LENGTH);
	return error;
}
Ejemplo n.º 2
0
XBee_Address::XBee_Address(const GBeeRxPacket *rx) :
	node("")
{
	addr16 = 	GBEE_USHORT(rx->srcAddr16);
	addr64h = 	GBEE_ULONG(rx->srcAddr64h);
	addr64l = 	GBEE_ULONG(rx->srcAddr64l);
}
Ejemplo n.º 3
0
GBeeError gbeeSendRemoteAtCommand(GBee *self, uint8_t frameId, uint32_t dstAddr64h,
		uint32_t dstAddr64l, uint16_t dstAddr16, uint8_t *atCmd, uint8_t cmdOpts,
		uint8_t *value, uint16_t length)
{
	// Error code returned by GBee.
	GBeeError error = GBEE_NO_ERROR;
	// Remote AT command parameters.
	GBeeRemoteAtCommand remoteAtCommand;

	// Check some pre-conditions.
	if (self->lastError != GBEE_NO_ERROR)
	{
		error = GBEE_INHERITED_ERROR;
	}
	GBEE_THROW(error);	

	// Assemble the AT command frame.
	remoteAtCommand.ident        = GBEE_REMOTE_AT_COMMAND;
	remoteAtCommand.frameId      = frameId;
	remoteAtCommand.dstAddr64h   = GBEE_ULONG(dstAddr64h);
	remoteAtCommand.dstAddr64l   = GBEE_ULONG(dstAddr64l);
	remoteAtCommand.dstAddr16    = GBEE_USHORT(dstAddr16);
	remoteAtCommand.atCommand[0] = atCmd[0];
	remoteAtCommand.atCommand[1] = atCmd[1];
	remoteAtCommand.cmdOpts      = cmdOpts;
	GBEE_PORT_MEMORY_COPY(remoteAtCommand.value, value, length);

	// Send the AT command frame.
	error = gbeeSend(self, (GBeeFrameData *)&remoteAtCommand,
			length + GBEE_REMOTE_AT_COMMAND_HEADER_LENGTH);
	return error;
}