コード例 #1
0
        private static void NimSignalingOptAcceptCallback(int code, IntPtr opt_res_param, IntPtr user_data)
        {
            NIMSignalingAcceptResParam accept_res_param = new NIMSignalingAcceptResParam();

            accept_res_param.info_ = new NIMSignalingChannelDetailedinfo();
            NIMSignalingJoinResParam_C res_param_c = (NIMSignalingJoinResParam_C)Marshal.PtrToStructure(opt_res_param, typeof(NIMSignalingJoinResParam_C));

            if (res_param_c != null)
            {
                accept_res_param.info_.channel_info_ = SignalHelper.NIMSignalingChannelInfoFromC(res_param_c.info_.channel_info_);
                for (int i = 0; i < res_param_c.info_.member_size_; i++)
                {
                    IntPtr src_data = NimUtility.IntPtrExtensions.Increment(res_param_c.info_.members_, i * Marshal.SizeOf(typeof(NIMSignalingMemberInfo_C)));
                    NIMSignalingMemberInfo_C member_info_c = (NIMSignalingMemberInfo_C)Marshal.PtrToStructure(src_data, typeof(NIMSignalingMemberInfo_C));
                    NIMSignalingMemberInfo   member_info   = SignalHelper.NIMSignalingMemberFromC(member_info_c);
                    accept_res_param.info_.members_.Add(member_info);
                }
            }

            NIMSignalingRejectOrAcceptResCode res_code = NIMSignalingRejectOrAcceptResCode.kUnknown;

            try
            {
                res_code = (NIMSignalingRejectOrAcceptResCode)Enum.Parse(typeof(NIMSignalingRejectOrAcceptResCode), code.ToString());
            }
            catch
            {
                res_code = NIMSignalingRejectOrAcceptResCode.kUnknown;
            }
            NimUtility.DelegateConverter.Invoke <NimSignalingOptAcceptHandler>(user_data, res_code, accept_res_param);
        }
コード例 #2
0
        private static void NimSignalingChannelsSyncCallback(IntPtr info_list, int size, IntPtr user_data)
        {
            List <NIMSignalingChannelDetailedinfo> channels = new List <NIMSignalingChannelDetailedinfo>();

            if (info_list != IntPtr.Zero)
            {
                for (int i = 0; i < size; i++)
                {
                    NIMSignalingChannelDetailedinfo channel_detailed_info = new NIMSignalingChannelDetailedinfo();

                    IntPtr detailed_ptr = NimUtility.IntPtrExtensions.Increment(info_list, i * Marshal.SizeOf(typeof(NIMSignalingChannelDetailedinfo_C)));
                    NIMSignalingChannelDetailedinfo_C detailed_info = (NIMSignalingChannelDetailedinfo_C)Marshal.PtrToStructure(detailed_ptr, typeof(NIMSignalingChannelDetailedinfo_C));

                    for (int j = 0; j < detailed_info.member_size_; j++)
                    {
                        IntPtr src_data = NimUtility.IntPtrExtensions.Increment(detailed_info.members_, j * Marshal.SizeOf(typeof(NIMSignalingMemberInfo_C)));
                        NIMSignalingMemberInfo_C member_info_c = (NIMSignalingMemberInfo_C)Marshal.PtrToStructure(src_data, typeof(NIMSignalingMemberInfo_C));
                        NIMSignalingMemberInfo   member_info   = SignalHelper.NIMSignalingMemberFromC(member_info_c);
                        channel_detailed_info.members_.Add(member_info);
                    }

                    channel_detailed_info.channel_info_ = SignalHelper.NIMSignalingChannelInfoFromC(detailed_info.channel_info_);
                    channels.Add(channel_detailed_info);
                }
            }
            NimUtility.DelegateConverter.Invoke <NimSignalingChannelsSyncHandler>(user_data, channels);
        }
コード例 #3
0
        private static void NimSignalingOptJoinCallback(int code, IntPtr opt_res_param, IntPtr user_data)
        {
            NIMSignalingJoinResParam res_param = new NIMSignalingJoinResParam();

            NIMSignalingJoinResParam_C res_param_c = (NIMSignalingJoinResParam_C)Marshal.PtrToStructure(opt_res_param, typeof(NIMSignalingJoinResParam_C));

            res_param.info_.channel_info_ = SignalHelper.NIMSignalingChannelInfoFromC(res_param_c.info_.channel_info_);
            for (int i = 0; i < res_param_c.info_.member_size_; i++)
            {
                IntPtr src_data = NimUtility.IntPtrExtensions.Increment(res_param_c.info_.members_, i * Marshal.SizeOf(typeof(NIMSignalingMemberInfo_C)));
                NIMSignalingMemberInfo_C member_info_c = (NIMSignalingMemberInfo_C)Marshal.PtrToStructure(src_data, typeof(NIMSignalingMemberInfo_C));
                NIMSignalingMemberInfo   member_info   = SignalHelper.NIMSignalingMemberFromC(member_info_c);
                res_param.info_.members_.Add(member_info);
            }

            NimUtility.DelegateConverter.Invoke <NimSignalingOptJoinHandler>(user_data, code, res_param);
        }
コード例 #4
0
        private static void NimSignalingMembersSyncCallback(IntPtr detailed_info, IntPtr user_data)
        {
            NIMSignalingChannelDetailedinfo channel_detailed_info = new NIMSignalingChannelDetailedinfo();


            if (detailed_info != IntPtr.Zero)
            {
                NIMSignalingChannelDetailedinfo_C res_param = (NIMSignalingChannelDetailedinfo_C)Marshal.PtrToStructure(detailed_info, typeof(NIMSignalingChannelDetailedinfo_C));
                channel_detailed_info.channel_info_ = SignalHelper.NIMSignalingChannelInfoFromC(res_param.channel_info_);
                for (int i = 0; i < res_param.member_size_; i++)
                {
                    IntPtr src_data = NimUtility.IntPtrExtensions.Increment(res_param.members_, i * Marshal.SizeOf(typeof(NIMSignalingMemberInfo_C)));
                    NIMSignalingMemberInfo_C member_info_c = (NIMSignalingMemberInfo_C)Marshal.PtrToStructure(src_data, typeof(NIMSignalingMemberInfo_C));
                    NIMSignalingMemberInfo   member_info   = SignalHelper.NIMSignalingMemberFromC(member_info_c);
                    channel_detailed_info.members_.Add(member_info);
                }
            }

            NimUtility.DelegateConverter.Invoke <NimSignalingMembersSyncHandler>(user_data, channel_detailed_info);
        }