Exemple #1
0
        /// <summary>
        /// 独立信令 关闭销毁频道
        /// 整个通话结束,如果只单人退出请调用NimSignalingLeave接口
        /// 该接口可以由创建者和频道内所有成员调用,无权限限制
        /// 调用该接口成功后,其他所有频道内的成员都回收到频道结束的通知,被动离开频道。此时其他成员不需要调用离开接口,也不会收到别人的离开通知。
        /// </summary>
        /// <param name="param">关闭频道的传入参数</param>
        /// <param name="cb">结果回调见NimSignalingDef.cs</param>
        public static void SignalingClose(NIMSignalingCloseParam param, NimSignalingOptCloseOrLeaveHandler cb)
        {
            NIMSignalingCloseParam_C param_c = SignalHelper.GetNativeNIMSignalingCloseParam(param);
            int    nSizeOfParam = Marshal.SizeOf(param_c);
            IntPtr param_ptr    = Marshal.AllocHGlobal(nSizeOfParam);

            try
            {
                Marshal.StructureToPtr(param_c, param_ptr, false);
                var user_ptr = NimUtility.DelegateConverter.ConvertToIntPtr(cb);
                SignalingNativeMethods.nim_signaling_close(param_ptr, NimSignalingCloseCb, user_ptr);
            }
            catch (Exception ex)
            {
            }
            finally
            {
                Marshal.FreeHGlobal(param_ptr);
            }
        }