29 printf(
" On chain %d, idcodes = [ ", chainIndex);
30 for (
size_t index = 0; index < idcodes->
length; index++)
32 printf(
"0x%04x ", idcodes->
data[index]);
60 printf(
"\nFacade_Exercise\n");
63 if (deviceChainFacade != NULL)
65 int numChains = deviceChainFacade->
NumChains();
66 printf(
" Showing idcodes of devices after a device reset (expect one device on each chain)...\n");
68 for (
int chainIndex = 0; chainIndex < numChains; ++chainIndex)
73 deviceChainFacade->
GetIdcodes(chainIndex, &idcodes);
78 printf(
" Showing idcodes of devices after selecting all devices...\n");
79 for (
int chainIndex = 0; chainIndex < numChains; ++chainIndex)
84 deviceChainFacade->
GetIdcodes(chainIndex, &idcodes);
static void _Facade_ShowIdCodes(int chainIndex, UIntArray *idcodes)
Helper function to present a formatted list of idcodes for a particular device chain....
void Facade_Exercise(void)
Example of using the Facade Pattern.
IDeviceNetworkHighLevel * Facade_GetHighLevelDeviceService(void)
Retrieve a set of function pointers to the high-level device service used in the Facade Pattern examp...
Declaration of the Facade_Exercise() function as used in the Facade Pattern.
Declaration of the IDeviceNetworkHighLevel interface representing the high-level system used in the F...
Represents a high level view of a complex network of device chains. A device chain can be thought of ...
void(* EnableDevicesInDeviceChain)(int chainIndex, uint32_t selectMask)
Make visible certain devices in the given device chain. The selectMask value has a bit set for each d...
int(* NumChains)(void)
The number of device chains available from the sub-system.
void(* GetIdcodes)(int chainIndex, UIntArray *idcodes)
Returns a list of all idcodes from all selected devices in the given device chain.
void(* DisableDevicesInDeviceChain)(int chainIndex)
Resets the given device chain so that all devices except the first are no longer visible.
Represents an array of 32-bit unsigned integers. The data field points to a block of memory allocated...
uint32_t * data
Pointer to array of 32-bit unsigned integers.
size_t length
Number of 32-bit unsigned integers actually in the data array.
void UIntArray_Initialize(UIntArray *array)
Initialize the given UIntArray object.
void UIntArray_Clear(UIntArray *array)
Clear the given UIntArray object so it can be reused again. Releases the list of integers.