Repository navigation
ASITiger: refactor the device base classes (plain ASIBase + ASIDevice template) - #1041
Merged
Merged
Conversation
added 7 commits
November 16, 2026 17:34
Member
|
Nice! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the
ASIBase<TDeviceBase, UConcreteDevice>/ASIPeripheralBase<...>class templates in ASITiger with a plainASIBaseclass plus a smallASIDevice<T>template, which lets the hub use the same code as the peripherals. The hub is no longer a special case:ASIHubderives fromASIDevice<HubBase<ASIHub>>and leaveshub_null.Class hierarchy
Arrows point from a class to its base class.
CZStagestands for the 13 device classes built on these bases; they all change the same way.ASIBaseclassASIDevice<T>templateBefore:
ASIBaseandASIPeripheralBasesit inside each device's CRTP chain, so every device class has its ownASIBase<...>. The hub derives fromASIBasedirectly, because it could not useASIPeripheralBase.flowchart BT SB["CStageBase#lt;CZStage#gt;"] HB["HubBase#lt;ASIHub#gt;"] AB_Z["ASIBase#lt;CStageBase, CZStage#gt;"] AB_H["ASIBase#lt;HubBase, ASIHub#gt;"] APB_Z["ASIPeripheralBase#lt;CStageBase, CZStage#gt;"] CZ["CZStage"] AH["ASIHub"] TC["CTigerCommHub"] AB_Z --> SB APB_Z --> AB_Z CZ --> APB_Z AB_H --> HB AH --> AB_H TC --> AH classDef mm fill:#e8e8e8,stroke:#888888,color:#222222 classDef perdevice fill:#fde2c8,stroke:#d9822b,color:#222222 classDef dev fill:#ffffff,stroke:#666666,color:#222222 class SB,HB mm class AB_Z,AB_H,APB_Z perdevice class CZ,AH,TC devAfter: one plain
ASIBaseclass holds the shared state and the helper functions, most of which live inASIBase.cpp.ASIDevice<T>derives from both the MM base class andASIBase, and the hub uses it like every other device.flowchart BT SB["CStageBase#lt;CZStage#gt;"] AB["ASIBase"] HB["HubBase#lt;ASIHub#gt;"] AD_Z["ASIDevice#lt;CStageBase#lt;CZStage#gt;#gt;"] AD_H["ASIDevice#lt;HubBase#lt;ASIHub#gt;#gt;"] CZ["CZStage"] AH["ASIHub"] TC["CTigerCommHub"] AD_Z --> SB AD_Z --> AB CZ --> AD_Z AD_H --> AB AD_H --> HB AH --> AD_H TC --> AH classDef mm fill:#e8e8e8,stroke:#888888,color:#222222 classDef shared fill:#cfe8cf,stroke:#3d8b3d,color:#222222 classDef tmpl fill:#d6e4f5,stroke:#3b6ea8,color:#222222 classDef dev fill:#ffffff,stroke:#666666,color:#222222 class SB,HB mm class AB shared class AD_Z,AD_H tmpl class CZ,AH,TC devWhere the old code went
ASIBase<>constructor (Name property, error messages)ASIDeviceconstructorASIPeripheralBase<>constructor (card address)ASIDeviceconstructorShutdown(),GetName(),Busy()ASIDevicePeripheralInitialize()ASIDevice::PeripheralInitialize(), usingASIBase::AttachHub(),QueryFirmwareInfo(),RegisterWithHub()ASIBase.cppFirmwareVersionAtLeast()ASIBase.hCTigerCommHub::Initialize()'s duplicate V/CD/BU queries and firmware propertiesASIBase::QueryFirmwareInfo()andASIDevice::CreateFirmwareProperties()(commit 5)Behavior changes
Behavior is unchanged, except:
0V,0CDand0BUinstead of0 V,0 CDand0 BU.ERR_UNRECOGNIZED_ANSWER, as on the peripherals. A controller that isn't a Tiger still getsDEVICE_NOT_SUPPORTEDfromTalkToTiger(), which runs first.Notes
AttachHub()usesstatic_cast<ASIHub*>instead ofdynamic_cast:GetParentHub()only returns a hub from the same device library, and every ASITiger hub is anASIHub.ASIDevice<T>takes the MM base class as an ordinary type parameter.