This page is a collection of different logic snippets used in the ezFIT design and implementation. The description, use and rationale for each logic snippet is documented here as way of permanently recording ideas and decisions made on the different solutions to various problems.
The list of topics are not necessarily related (at least, not directly), so each topic should be treated atomically and independently of the others.
In order for the fitting module to discover the available drivers, manufacturers, circuits and instruments available to the application, we need to perform the following tasks:
Methodology:
InstrDrvManufacturerName.bpl
) to discover available driver libraries. Eg: InstrDrvIntricon.bpl, InstrDrvSoundTech.bpl, InstrDrvSonic.bpl
.proddefManufacturerName.xml
) with Circuit and Instrument data. Eg: proddefIntricon.xml
: <?xml version="1.0" encoding="UTF-8"?> <ProdDef version="1.0" manuf="Intricon"> <product code="prod_Intuition4" name="Intuition 4" id="0" circuit="DigitalOneNR4" visible="1" discontinued="0" active="1"> <localization> <lang code="en"> <shortname>Intuition 4</shortname> <longname>Intuition 4 (4 channels)</longname> </lang> <lang code="es"> <shortname>Intuition 4</shortname> <longname>Intuition 4 (4 canales)</longname> </lang> </localization> <styles> <style name="CIC"> <localization> <lang code="en"><name>CIC</name></lang> <lang code="es"><name>CIC</name></lang> </localization> <ranges> <range freq="250" minresp="30" maxresp="50"/> <range freq="1000" minresp="30" maxresp="70"/> <range freq="3000" minresp="30" maxresp="80"/> </ranges> </style> <style name="Mini Canal"> <localization> <lang code="en"><name>Mini Canal</name></lang> <lang code="es"><name>Mini Canal</name></lang> </localization> <ranges> <range freq="250" minresp="30" maxresp="50"/> <range freq="1000" minresp="30" maxresp="70"/> <range freq="3000" minresp="30" maxresp="80"/> </ranges> </style> <style name="Canal"> <localization> <lang code="en"><name>Canal</name></lang> <lang code="es"><name>Canal</name></lang> </localization> <ranges> <range freq="250" minresp="30" maxresp="50"/> <range freq="1000" minresp="30" maxresp="70"/> <range freq="3000" minresp="30" maxresp="80"/> </ranges> </style> <style name="Half Shell"> <localization> <lang code="en"><name>Half Shell</name></lang> <lang code="es"><name>Media Concha</name></lang> </localization> <ranges> <range freq="250" minresp="30" maxresp="50"/> <range freq="1000" minresp="30" maxresp="70"/> <range freq="3000" minresp="30" maxresp="80"/> </ranges> </style> <style name="Full Shell"> <localization> <lang code="en"><name>Full Shell</name></lang> <lang code="es"><name>Concha Entera</name></lang> </localization> <ranges> <range freq="250" minresp="30" maxresp="50"/> <range freq="1000" minresp="30" maxresp="70"/> <range freq="3000" minresp="30" maxresp="80"/> </ranges> </style> <style name="Super60"> <localization> <lang code="en"><name>Super60</name></lang> <lang code="es"><name>Super60</name></lang> </localization> <ranges> <range freq="250" minresp="30" maxresp="50"/> <range freq="1000" minresp="30" maxresp="70"/> <range freq="3000" minresp="30" maxresp="80"/> </ranges> </style> <style name="BTE"> <localization> <lang code="en"><name>BTE</name></lang> <lang code="es"><name>Retro</name></lang> </localization> <ranges> <range freq="250" minresp="30" maxresp="50"/> <range freq="1000" minresp="30" maxresp="70"/> <range freq="3000" minresp="30" maxresp="80"/> </ranges> </style> <style name="OTE"> <localization> <lang code="en"><name>OTE</name></lang> <lang code="es"><name>OTE</name></lang> </localization> <ranges> <range freq="250" minresp="30" maxresp="50"/> <range freq="1000" minresp="30" maxresp="70"/> <range freq="3000" minresp="30" maxresp="80"/> </ranges> </style> <style name="Stock"> <localization> <lang code="en"><name>Stock Pre-Fab</name></lang> <lang code="es"><name>Prefabricado</name></lang> </localization> <ranges> <range freq="250" minresp="30" maxresp="50"/> <range freq="1000" minresp="30" maxresp="70"/> <range freq="3000" minresp="30" maxresp="80"/> </ranges> </style> </styles> </product> </ProdDef>
To ensure that a reference to a product and/or circuit is unique, and also not stored in the application, we need to have a mechanism that will provide this simply by using libraries (DLLs or BPLs).
Requirements:
Purposes:
Abstract Interface:
Pre-conditions:
prod_Intuition4
can have styles style_CIC, style_MiniCanal, style_Canal, style_HalfShell, style_FullShell, style_BTE, style_Stock, style_Security
.cir_DigitalOne4NRPlus
can have products prod_Intuition4=1, prod_Sparo=2, prod_TransEar=3
.InstrDrvIntricon.bpl
can have circuits cir_DigitalOne2CT, cir_DigitalOne4AFC, cir_DigitalOne4NRPlus, cir_Intune, cir_Spin, cir_Ethos
.manf_SoundDesignTech
, manf_Intricon
, manf_Sonic
.Logistics:
CircuitManuf + CircuitID
.CircuitManuf + CircuitID + ProductID + StyleID
.CircuitManuf + CircuitID + ProductID
.Assumming the following ProdAndStyleID values:
// Product and Style IDs to be stored on Word2 (manuf reserved words) and ProdAndStyleID BTE_I4 = 1; // Intuition 4 BTE_I4D = 2; // Intuition D (Directional) BTE_I2 = 3; // Intuition 2 (2 ch) FSS_I2 = 4; // Intuition 2 (2 ch) ITE_I2 = 5; // Intuition 2 (2 ch) FSS_I4 = 6; // Intuition 4 ITC_I4 = 7; // Intuition 4 CIC_I4 = 8; // Intuition 4 HS_I4 = 9; // Intuition 4 MiniCanal_I4 = 10; // Intuition 4 Canal_I4 = 11; // Intuition 4 Super60_I4 = 12; // Intuition 4 ezHear_I4 = 13; // Intuition 4 FSS_ClariD = 14; // Clari-D CIC_ClariD = 15; // Clari-D HS_ClariD = 16; // Clari-D MiniCanal_ClariD = 17; // Clari-D Canal_ClariD = 18; // Clari-D Super60_ClariD = 19; // Clari-D ... CIC_I8 = 1; // Intuition 8 CIC_I8Power = 2; // Intuition 8 MiniCanal_I8 = 3; // Intuition 8 MiniCanal_I8Power = 4; // Intuition 8 Canal_I8 = 5; // Intuition 8 Canal_I8Power = 6; // Intuition 8 HS_I8 = 7; // Intuition 8 HS_I8Power = 8; // Intuition 8 FSS_I8 = 9; // Intuition 8 FSS_I8Power = 10; // Intuition 8 Super60_I8 = 11; // Intuition 8 ezHear_I8 = 12; // Intuition 8 OTE_Flx = 13; // Flx, an OTE based on Ethos circuit
ACircuitCode := GetCircuitCodeFromInstrument(); // eg. cir_DigitalOne4NRPlus MyCircuitCode := GetCircuitCode(manf_Intricon, ACircuitCode);
ACircuitCode := GetCircuitCodeFromInstrument(); // eg. cir_DigitalOne4NRPlus MyProductCode := GetProductCode(manuf_Intricon, ACircuitCode, AProdAndStyleID {eg. 11}); // eg. 11 = Intuition4 + Canal // use product in some statement if MyProductCode in [prod_Intuition4, prod_TransEar] then begin // do some work ... end;
ACircuitCode := GetCircuitCodeFromInstrument(); // eg. cir_DigitalOne4NRPlus MyStyleCode := GetStyleCode(manuf_Intricon, ACircuitCode, AProdAndStyleID {eg. 11}); // eg. 11 = Intuition4 + Canal // use style in some statement if MyStyleCode in [style_CIC, style_MiniCanal, style_Canal] then begin // do some work ... end;