Information to work with Generic Serial Hardware Interface

HouseBot Plugin Development Discussions.
Post Reply
EdInNY
Member
Posts: 2
Joined: Sun Jun 14, 2009 8:11 am
Location: Endicott, NY

Information to work with Generic Serial Hardware Interface

Post by EdInNY »

Hi All,
I am attempting to use the SDK to write a Device that uses the Generic Serial Hardware Interface.
This device will be used to communicate to wireless devices I will build using Atmel hardware and BitCloud Zigbee stack.

From the logs I can see the notification list is "Generic Serial Data Received", and I can get the notifications.
However I am having trouble finding the rest of the information needed, such as:
- The names of data (szDataName) in the DataPack to read the data
- Information on the InterfaceArgumentPack to write to the Serial Interface
- Other details I need that I don't know I need yet.

Thanks for any help,
- Ed
ScottBot
Site Admin
Posts: 2786
Joined: Thu Feb 13, 2003 6:46 pm
Location: Georgia (USA)
Contact:

Re: Information to work with Generic Serial Hardware Interface

Post by ScottBot »

Ed,

From the Device subscription notification method, you can access "Raw Data" or "Hex Data" from the argument pack.

Sending data to the interface is done like:

Code: Select all

	//
	// Construct the Interface Argument Pack
	InterfaceArgumentPack	Pack;

	//
	// Setup the Pack
	Pack.m_nArgumentPackVersion = INTERFACE_PACK_VERSION;
	Pack.m_szInterfaceSignature = "SendSerialCommand( Command, [Argument1] )";
	Pack.m_nNumberOfArguments = 2;
	Pack.m_aArguments = new InterfaceArgument[ 2 ];

	//
	// Assign the arguments.
	Pack.m_aArguments[ 0 ].m_atType = atStringValue;
	Pack.m_aArguments[ 0 ].m_szStringValue = pCommand->m_szCommand;

	Pack.m_aArguments[ 1 ].m_atType = atStringValue;
	Pack.m_aArguments[ 1 ].m_szStringValue = szValue;

	HARDWARE_RC rc = SendInterfacePackToInterface( &Pack );
Finding the 'pCommand' object for the snippet above, can be done with:

Code: Select all

		//
		// See if there is a map for this value.
		if ((pProperty->GetGenericCommandsAssociatedWithValue( pValue, NULL, &dwBuffSize )) &&
			 (dwBuffSize))
		{
			//
			// Allocate the array memory
			GenericCommand* pCommandArray = (GenericCommand*)malloc( dwBuffSize );
			BOOL	bRc = FALSE;

			pProperty->GetGenericCommandsAssociatedWithValue( pValue, pCommandArray, &dwBuffSize );
Hopefully this should get you over the hurtle. If you have more questions, feel free to ask more.
Scott
Post Reply