Exemplo n.º 1
0
            public object MarshalNativeToManaged(System.IntPtr pNativeData)
            {
                Marshal.PtrToStructure(pNativeData, this.marshaledObj.evt);

                if (this.marshaledObj.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION)
                {
                    this.marshaledObj.evt.cstaConfirmation = (CSTAConfirmationEvent)Aux.ByteArrayToStructure <CSTAConfirmationEvent>(this.marshaledObj.evt.heap);
                }

                // Marshal SnapShotCall Event
                if (this.marshaledObj.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION &&
                    this.marshaledObj.evt.eventHeader.eventType.eventType == Csta.CSTA_SNAPSHOT_CALL_CONF)
                {
                    this.marshaledObj.evt.cstaConfirmation.snapshotCall = (Csta.CSTASnapshotCallConfEvent_t)Aux.ByteArrayToStructure <Csta.CSTASnapshotCallConfEvent_t>(this.marshaledObj.evt.cstaConfirmation.heap);
                    int    infoCount = this.marshaledObj.evt.cstaConfirmation.snapshotCall.snapshotData.count;
                    IntPtr pInfo     = this.marshaledObj.evt.cstaConfirmation.snapshotCall.snapshotData.pInfo;
                    Csta.CSTASnapshotCallResponseInfo_t[] infoArray = new CSTASnapshotCallResponseInfo_t[infoCount];
                    int infoSize = Marshal.SizeOf(new CSTASnapshotCallResponseInfo_t());
                    for (int i = 0; i < infoCount; i++)
                    {
                        infoArray[i] = (CSTASnapshotCallResponseInfo_t)Marshal.PtrToStructure(new IntPtr(pInfo.ToInt32() + infoSize * i), typeof(CSTASnapshotCallResponseInfo_t));
                    }
                    this.marshaledObj.auxData.Add("snapCallInfo", infoArray);
                }

                // Marshal SnapShotDevice Event
                if (this.marshaledObj.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION &&
                    this.marshaledObj.evt.eventHeader.eventType.eventType == Csta.CSTA_SNAPSHOT_DEVICE_CONF)
                {
                    this.marshaledObj.evt.cstaConfirmation.snapshotDevice = (CSTASnapshotDeviceConfEvent_t)Aux.ByteArrayToStructure <CSTASnapshotDeviceConfEvent_t>(this.marshaledObj.evt.cstaConfirmation.heap);
                    int    infoCount = this.marshaledObj.evt.cstaConfirmation.snapshotDevice.snapshotData.count;
                    IntPtr pInfo     = this.marshaledObj.evt.cstaConfirmation.snapshotDevice.snapshotData.pInfo;
                    Csta.CSTASnapshotDeviceResponseInfo_t[] infoArray = new CSTASnapshotDeviceResponseInfo_t[infoCount];
                    int infoSize = Marshal.SizeOf(new CSTASnapshotDeviceResponseInfo_t());
                    for (int i = 0; i < infoCount; i++)
                    {
                        infoArray[i] = (CSTASnapshotDeviceResponseInfo_t)Marshal.PtrToStructure(new IntPtr(pInfo.ToInt32() + infoSize * i), typeof(CSTASnapshotDeviceResponseInfo_t));
                        int    stateCount = infoArray[i].localCallState.count;
                        IntPtr pState     = infoArray[i].localCallState.pState;
                        LocalConnectionState_t[] stateArray = new LocalConnectionState_t[stateCount];
                        for (int j = 0; j < stateCount; j++)
                        {
                            stateArray[j] = (LocalConnectionState_t)Marshal.ReadInt32(pState, (sizeof(int) * j));
                        }
                        this.marshaledObj.auxData.Add("snapDeviceState" + i, stateArray);
                    }
                    this.marshaledObj.auxData.Add("snapDeviceInfo", infoArray);
                }
                return(this.marshaledObj);
            }
Exemplo n.º 2
0
            public object MarshalNativeToManaged(System.IntPtr pNativeData)
            {
                Marshal.PtrToStructure(pNativeData, this.marshaledObj.evt);

                if (this.marshaledObj.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION)
                {
                this.marshaledObj.evt.cstaConfirmation = (CSTAConfirmationEvent)Aux.ByteArrayToStructure<CSTAConfirmationEvent>(this.marshaledObj.evt.heap);
                }

                // Marshal SnapShotCall Event
                if (this.marshaledObj.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION &&
                this.marshaledObj.evt.eventHeader.eventType.eventType == Csta.CSTA_SNAPSHOT_CALL_CONF)
                {
                this.marshaledObj.evt.cstaConfirmation.snapshotCall = (Csta.CSTASnapshotCallConfEvent_t)Aux.ByteArrayToStructure<Csta.CSTASnapshotCallConfEvent_t>(this.marshaledObj.evt.cstaConfirmation.heap);
                int infoCount = this.marshaledObj.evt.cstaConfirmation.snapshotCall.snapshotData.count;
                IntPtr pInfo = this.marshaledObj.evt.cstaConfirmation.snapshotCall.snapshotData.pInfo;
                Csta.CSTASnapshotCallResponseInfo_t[] infoArray = new CSTASnapshotCallResponseInfo_t[infoCount];
                int infoSize = Marshal.SizeOf(new CSTASnapshotCallResponseInfo_t());
                for (int i = 0; i < infoCount; i++)
                {
                    infoArray[i] = (CSTASnapshotCallResponseInfo_t)Marshal.PtrToStructure(new IntPtr(pInfo.ToInt32() + infoSize * i), typeof(CSTASnapshotCallResponseInfo_t));
                }
                this.marshaledObj.auxData.Add("snapCallInfo", infoArray);
                }

                // Marshal SnapShotDevice Event
                if (this.marshaledObj.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION &&
                this.marshaledObj.evt.eventHeader.eventType.eventType == Csta.CSTA_SNAPSHOT_DEVICE_CONF)
                {
                this.marshaledObj.evt.cstaConfirmation.snapshotDevice = (CSTASnapshotDeviceConfEvent_t)Aux.ByteArrayToStructure<CSTASnapshotDeviceConfEvent_t>(this.marshaledObj.evt.cstaConfirmation.heap);
                int infoCount = this.marshaledObj.evt.cstaConfirmation.snapshotDevice.snapshotData.count;
                IntPtr pInfo = this.marshaledObj.evt.cstaConfirmation.snapshotDevice.snapshotData.pInfo;
                Csta.CSTASnapshotDeviceResponseInfo_t[] infoArray = new CSTASnapshotDeviceResponseInfo_t[infoCount];
                int infoSize = Marshal.SizeOf(new CSTASnapshotDeviceResponseInfo_t());
                for (int i = 0; i < infoCount; i++)
                {
                    infoArray[i] = (CSTASnapshotDeviceResponseInfo_t)Marshal.PtrToStructure(new IntPtr(pInfo.ToInt32() + infoSize * i), typeof(CSTASnapshotDeviceResponseInfo_t));
                    int stateCount = infoArray[i].localCallState.count;
                    IntPtr pState = infoArray[i].localCallState.pState;
                    LocalConnectionState_t[] stateArray = new LocalConnectionState_t[stateCount];
                    for (int j = 0; j < stateCount; j++)
                    {
                        stateArray[j] = (LocalConnectionState_t)Marshal.ReadInt32(pState, (sizeof(int) * j));
                    }
                    this.marshaledObj.auxData.Add("snapDeviceState" + i, stateArray);
                }
                this.marshaledObj.auxData.Add("snapDeviceInfo", infoArray);
                }
                return this.marshaledObj;
            }