Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Only used to determine Code
- [StructLayout(LayoutKind.Sequential)]
- internal struct TagFM_NOTIFICATION_INTERNAL
- {
- public FMN_ACTIONS Code;
- public uint Timestamp;
- public IntPtr DataPtr;
- }
- // Based on code, Ptr is marshalled to FREQ
- [StructLayout(LayoutKind.Sequential)]
- internal struct TagFM_NOTIFICATION_FREQ_INTERNAL
- {
- public FMN_ACTIONS Code;
- public uint Timestamp;
- public FMN_FREQUENT_CHANGED FreqData;
- }
- // Or to RDS
- [StructLayout(LayoutKind.Sequential)]
- internal struct TagFM_NOTIFICATION_RDS_INTERNAL
- {
- public FMN_ACTIONS Code;
- public uint Timestamp;
- public FMN_RDS_RECEIVED_INTERNAL RdsData;
- }
- // RDSData is another IntPtr as it points to an array
- [StructLayout(LayoutKind.Sequential)]
- internal struct FMN_RDS_RECEIVED_INTERNAL
- {
- public ushort RDSCount;
- public IntPtr RDSData;
- }
- // Marshalling each group and adding it to a list
- List<FM_RDS_GROUP> groups = new List<FM_RDS_GROUP>();
- for (int i = 0; i < iRdsNotify.RdsData.RDSCount; i++)
- {
- IntPtr ptr = iRdsNotify.RdsData.RDSData;
- int intptr = (int)ptr;
- intptr += i * Marshal.SizeOf(typeof(FM_RDS_GROUP));
- ptr = (IntPtr)intptr;
- FM_RDS_GROUP group = (FM_RDS_GROUP)Marshal.PtrToStructure(ptr, typeof(FM_RDS_GROUP));
- groups.Add(group);
- }
Add Comment
Please, Sign In to add comment