Hi. I'm using ffi and ref-struct in a project and ran into a strange issue today. I have a struct with several boolean members. All of these boolean members are being set correctly except for one and I can't for the life of me figure out what's going on. Here's some code:
Struct definition
const RPC_CALL_STATE = StructType({
eCallState: ref.types.int,
bInboundCall: ref.types.bool,
bVideoCall: ref.types.bool,
bRecording: ref.types.bool,
bEncrypted: ref.types.bool,
bHDAudio: ref.types.bool,
bVirtualMeetingCall: ref.types.bool,
eCurrentCodec: ref.types.int,
eAlertInfoType: ref.types.int,
dAccumulatedMOSLQ: ref.types.double,
nVideoState: ref.types.int,
nErrorCode: ref.types.int,
nCallStartTime: ref.types.uint,
cPhoneNumber: FixedBuffer(RPC_STRING_LENGTH),
cName: FixedBuffer(RPC_STRING_LENGTH),
cCallId: FixedBuffer(RPC_STRING_LENGTH_CALLID),
cPreviousCallId: FixedBuffer(RPC_STRING_LENGTH_CALLID),
});
The member in question is bEncrypted. I have verified that the C code is sending the correct value but, no matter what it sends, bEncrypted is always false. Yet, bInboundCall, bHDAudio, and bVirtualMeetingCall all work as expected. I tried changing the type to ref.types.int and I do see 0 or 1 but then bHDAudio is showing false when it should be true.
Consuming code
const pDataRef = ref.reinterpret(pData, RPC_DATA_CALL_PROGRESS.size);
pDataRef.type = RPC_DATA_CALL_PROGRESS;
this.callProgressObj = pDataRef.deref();
this.callProgressArray = this.callProgressObj.xCallState;
The callProgressArray is an array of RPC_CALL_STATE structs. This is a huge blocker for my team and project so any help you can provide would be greatly appreciated. Let me know if you have questions or need more detail. Thanks!
Hi. I'm using
ffiandref-structin a project and ran into a strange issue today. I have a struct with several boolean members. All of these boolean members are being set correctly except for one and I can't for the life of me figure out what's going on. Here's some code:Struct definition
The member in question is
bEncrypted. I have verified that the C code is sending the correct value but, no matter what it sends,bEncryptedis always false. Yet,bInboundCall,bHDAudio, andbVirtualMeetingCallall work as expected. I tried changing the type toref.types.intand I do see 0 or 1 but thenbHDAudiois showing false when it should be true.Consuming code
The
callProgressArrayis an array ofRPC_CALL_STATEstructs. This is a huge blocker for my team and project so any help you can provide would be greatly appreciated. Let me know if you have questions or need more detail. Thanks!