Implementation of the IDeviceNetworkLowLevel interface and the complex system it represents for the Facade Pattern. More...
Go to the source code of this file.
Classes | |
struct | DeviceNode |
Represents a single device. Part of the Facade Pattern example. More... | |
struct | DeviceChain |
Represents a single device chain, a collection of DeviceNode objects. More... | |
Functions | |
static void | DeviceChain_ShowHideNodes (int chainIndex, uint32_t nodeSelectMask, bool makeVisible) |
Helper function to show or hide devices on the device chain. | |
static void | DeviceChain_ResetVisibility (int chainIndex) |
Resets the specified device chain so that all devices that are not device controllers are no longer visible in the device chain. | |
static void | DeviceChain_SelectNodes (int chainIndex, uint32_t nodeSelectMask) |
Make visible one or more devices in the device chain. | |
static void | DeviceChain_DeselectNodes (int chainIndex, uint32_t nodeSelectMask) |
Make invisible one or more devices in the device chain. | |
static void | DeviceChain_GetIdCodesForVisibleNodes (int chainIndex, UIntArray *idcodes) |
Retrieve a list of idcodes for all devices that are visible in the device chain. | |
static int | GetNumChains (void) |
Retrieve the number of device chains. | |
static bool | LockDeviceChain (int chainIndex) |
Lock the specified device chain to indicate exclusive access is desired. | |
static bool | UnlockDeviceChain (int chainIndex) |
Unlock the specified device chain to indicate exclusive access is no longer desired. | |
static void | ResetDeviceChain (int chainIndex) |
Reset the visibility of all devices on the given device chain so that all devices except the first are not visible. | |
static void | EnableDevicesInDeviceChain (int chainIndex, uint32_t deviceselectMask) |
Select one or more devices in the given device chain so those devices are visible. | |
static void | DisableDevicesInDeviceChain (int chainIndex, uint32_t deviceselectMask) |
Deselect one or more devices in the given device chain so those devices are no longer visible. | |
static void | GetIdcodes (int chainIndex, UIntArray *idcodes) |
Retrieve a list of idcodes of all visible devices in the given device chain. | |
IDeviceNetworkLowLevel * | Facade_GetLowLevelDeviceService (void) |
Retrieve a set of function pointers to the low-level device service used in the Facade Pattern example. | |
Variables | |
static DeviceNode | deviceChain0 [] |
Device Chain 0, with 3 devices. The first device is always the device controller, which is always visible. | |
static DeviceNode | deviceChain1 [] |
Device Chain 1, with 3 devices. The first device is always the device controller, which is always visible. | |
static DeviceChain | deviceChains [] |
Device chains. There are two device chains, which are accessed separately. Each chain has its own lock for access, which is initially unlocked. | |
static int | deviceChainCount = (int)(sizeof(deviceChains) / sizeof(deviceChains[0])) |
Number of device chains that have been pre-defined. | |
IDeviceNetworkLowLevel | lowlevelService |
Definition of the IDeviceNetworkLowLevel interface, using function pointers to each function. | |
Implementation of the IDeviceNetworkLowLevel interface and the complex system it represents for the Facade Pattern.
Definition in file Facade_ComplexSystem.c.
|
static |
Make invisible one or more devices in the device chain.
chainIndex | Index of the device chain to manipulate. |
nodeSelectMask | a bit mask specifying which device or devices to hide, where bit 0 is the first device, bit 1 is the second, etc. Bit 0 is ignored as the first device is always visible. |
Definition at line 179 of file Facade_ComplexSystem.c.
References DeviceChain_ShowHideNodes().
Referenced by DisableDevicesInDeviceChain().
|
static |
Retrieve a list of idcodes for all devices that are visible in the device chain.
chainIndex | Index of the device chain to manipulate. |
idcodes | Returns an array of idcodes for each visible device, with the first device being at index 0. This UIntArray object needs to be initialized before use with UIntArray_Initialize() and freed after use with UIntArray_Clear(). |
Definition at line 194 of file Facade_ComplexSystem.c.
References deviceChainCount, deviceChains, DeviceChain::nodes, DeviceChain::numNodes, and UIntArray_AddInt().
Referenced by GetIdcodes().
|
static |
Resets the specified device chain so that all devices that are not device controllers are no longer visible in the device chain.
chainIndex | Index of the device chain to manipulate. |
Definition at line 144 of file Facade_ComplexSystem.c.
References deviceChainCount, deviceChains, DEVICECONTROLLER, DeviceChain::nodes, DeviceChain::numNodes, and DeviceNode::Visible.
Referenced by ResetDeviceChain().
|
static |
Make visible one or more devices in the device chain.
chainIndex | Index of the device chain to manipulate. |
nodeSelectMask | a bit mask specifying which device or devices to make visible, where bit 0 is the first device, bit 1 is the second, etc. Bit 0 is ignored as the first device is always visible. |
Definition at line 167 of file Facade_ComplexSystem.c.
References DeviceChain_ShowHideNodes().
Referenced by EnableDevicesInDeviceChain().
|
static |
Helper function to show or hide devices on the device chain.
chainIndex | Index of the device chain to manipulate. |
nodeSelectMask | A bit mask where the position of each bit corresponds to a device in the device chain, with bit 0 being the first device, bit 1 being the second device, and so on. |
makeVisible | true if the device is to be made visible on the device chain; otherwise false, the device cannot be seen on the device chain. |
Definition at line 112 of file Facade_ComplexSystem.c.
References deviceChainCount, deviceChains, DeviceChain::nodes, DeviceChain::numNodes, and DeviceNode::Visible.
Referenced by DeviceChain_DeselectNodes(), and DeviceChain_SelectNodes().
|
static |
Deselect one or more devices in the given device chain so those devices are no longer visible.
chainIndex | The index of the device chain to access (0..n-1). |
deviceselectMask | A bit mask indicating which devices to make invisible, with bit 0 corresponding to the first device, bit 1 corresponding to the second device, etc. Bit 0 is ignored as the first device is always visible. |
Definition at line 319 of file Facade_ComplexSystem.c.
References DeviceChain_DeselectNodes(), and deviceChainCount.
|
static |
Select one or more devices in the given device chain so those devices are visible.
chainIndex | The index of the device chain to access (0..n-1). |
deviceselectMask | A bit mask indicating which devices to make visible, with bit 0 corresponding to the first device, bit 1 corresponding to the second device, etc. Bit 0 is ignored as the first device is always visible. |
Definition at line 302 of file Facade_ComplexSystem.c.
References DeviceChain_SelectNodes(), and deviceChainCount.
IDeviceNetworkLowLevel * Facade_GetLowLevelDeviceService | ( | void | ) |
Retrieve a set of function pointers to the low-level device service used in the Facade Pattern example.
Definition at line 368 of file Facade_ComplexSystem.c.
References lowlevelService.
Referenced by _InitializeLowLevelSystem().
|
static |
Retrieve a list of idcodes of all visible devices in the given device chain.
chainIndex | Index of the device chain (0..n-1). |
idcodes | Returns an array of idcodes for each visible TAP, with the first TAP being at index 0. This UIntArray object needs to be initialized before use with UIntArray_Initialize() and freed after use with UIntArray_Clear(). |
Definition at line 335 of file Facade_ComplexSystem.c.
References DeviceChain_GetIdCodesForVisibleNodes(), and deviceChainCount.
|
static |
Retrieve the number of device chains.
Definition at line 229 of file Facade_ComplexSystem.c.
References deviceChainCount.
Referenced by DeviceNetworkHighLevel::GetNumChains().
|
static |
Lock the specified device chain to indicate exclusive access is desired.
chainIndex | The index of the device chain to access (0..n-1). |
Definition at line 241 of file Facade_ComplexSystem.c.
References deviceChainCount, deviceChains, and DeviceChain::IsLocked.
Referenced by DeviceNetworkHighLevel::DisableDevicesInDeviceChain(), DeviceNetworkHighLevel::EnableDevicesInDeviceChain(), and DeviceNetworkHighLevel::GetIdcodes().
|
static |
Reset the visibility of all devices on the given device chain so that all devices except the first are not visible.
chainIndex | The index of the device chain to access (0..n-1). |
Definition at line 285 of file Facade_ComplexSystem.c.
References DeviceChain_ResetVisibility(), and deviceChainCount.
Referenced by DeviceNetworkHighLevel::DisableDevicesInDeviceChain().
|
static |
Unlock the specified device chain to indicate exclusive access is no longer desired.
chainIndex | The index of the device chain to access (0..n-1). |
Definition at line 264 of file Facade_ComplexSystem.c.
References deviceChainCount, deviceChains, and DeviceChain::IsLocked.
Referenced by DeviceNetworkHighLevel::DisableDevicesInDeviceChain(), DeviceNetworkHighLevel::EnableDevicesInDeviceChain(), and DeviceNetworkHighLevel::GetIdcodes().
|
static |
Device Chain 0, with 3 devices. The first device is always the device controller, which is always visible.
Definition at line 67 of file Facade_ComplexSystem.c.
|
static |
Device Chain 1, with 3 devices. The first device is always the device controller, which is always visible.
Definition at line 78 of file Facade_ComplexSystem.c.
|
static |
Number of device chains that have been pre-defined.
Definition at line 97 of file Facade_ComplexSystem.c.
Referenced by DeviceChain_GetIdCodesForVisibleNodes(), DeviceChain_ResetVisibility(), DeviceChain_ShowHideNodes(), DisableDevicesInDeviceChain(), EnableDevicesInDeviceChain(), GetIdcodes(), GetNumChains(), LockDeviceChain(), ResetDeviceChain(), and UnlockDeviceChain().
|
static |
Device chains. There are two device chains, which are accessed separately. Each chain has its own lock for access, which is initially unlocked.
Definition at line 89 of file Facade_ComplexSystem.c.
Referenced by DeviceChain_GetIdCodesForVisibleNodes(), DeviceChain_ResetVisibility(), DeviceChain_ShowHideNodes(), LockDeviceChain(), and UnlockDeviceChain().
IDeviceNetworkLowLevel lowlevelService |
Definition of the IDeviceNetworkLowLevel interface, using function pointers to each function.
The function pointers set here must be in the same order they are defined in the IDeviceNetworkLowLevel structure representing the interface.
Definition at line 355 of file Facade_ComplexSystem.c.
Referenced by Facade_GetLowLevelDeviceService().