Non, je ne suis plus du tout dans ce métier, j'ai vaguement fait un système d'Interphone mais bricolage, non standard
C# DotNet, suffit que l'Interopérabilité COM soit activé !
Facile à voir, suffit de l'installer, de voir si Delphi le voit dans Import de Bibliothèque de Type
Pense que tu as un sacré chantier, exemple
Et dans certains cas, tu peux utiliser une énumération et son ensemble comme masque binaire
1 2 3 4 5 6 7 8 9 10 11 12
|
struct
{
// Struct is reversed due to bit order
uint8_t confirm:1; // 0 = no error, 1 = error
uint8_t ack:1; // 0 = no ack, 1 = ack
uint8_t priority:2; // 0 = system, 1 = high, 2 = urgent/alarm, 3 = normal
uint8_t system_broadcast:1; // 0 = system broadcast, 1 = broadcast
uint8_t repeat:1; // 0 = repeat on error, 1 = do not repeat
uint8_t reserved:1; // always zero
uint8_t frame_type:1; // 0 = extended, 1 = standard
} bits; |
cela se traduit en Delphi par
1 2 3 4 5 6 7 8 9 10
| TKNX_cemi_service_control1_Enum = (
knxcsccError,
knxcscaAck,
knxcscpHighOrNormal, knxcscpUrgentOrNormal,
knxcscsbBroadcast,
knxcscrDoNotRepeat,
knxcscrdReservedNotUse,
knxcscftStandard
;)
TKNX_cemi_service_control1_Bits = set of TKNX_cemi_service_control1_Enum; |
Faudra vérifier l'ordre, c'est peut-être l'inverse, l'idée c'est d'associer une valeur à chaque bits, du bit 0 au bit 7
Pour écrire
1 2 3 4 5 6 7
| bits.confirm = 1;
bits.ack = 1;
bits.priority = 3; // normal
bits.system_broadcast = 1;
bits.repeat = 1;
bits.reserved = 0;
bits.frame_type = 1; |
bits := [knxcsccNoError, knxcscpHighOrNormal, knxcscpUrgentOrNormal, knxcscsbBroadcast, knxcscrDoNotRepeat, knxcscftStandard];
1 2 3 4 5 6 7 8
| if (bits.priority == 0)
{system}
else if (bits.priority == 1)
{high}
else if (bits.priority == 2)
{urgent/alarm}
else if (bits.priority == 3)
{normal} |
1 2 3 4 5 6 7 8
| if (knxcscpHighOrNormal in bits) and not (knxcscpUrgentOrNormal in bits) then
high
else if not (knxcscpHighOrNormal in bits) and (knxcscpUrgentOrNormal in bits) then
urgent/alarm
else if (knxcscpHighOrNormal in bits) and (knxcscpUrgentOrNormal in bits) then
normal
else
system |
Partager