コード例 #1
0
        /// <summary>
        /// 独立信令 呼叫接口
        /// 用于用户新开一个频道并邀请对方加入频道,如果返回码不是200、10201、10202时,sdk会主动关闭频道,标记接口调用失败
        /// 该接口为组合接口,等同于用户先创建频道,成功后加入频道并邀请对方
        /// </summary>
        /// <param name="param">呼叫的传入参数</param>
        /// <param name="cb">结果回调见NimSignalingDef.cs</param>
        public static void Call(NIMSignalingCallParam param, CallDelegate cb)
        {
            int    nSizeOfParam = Marshal.SizeOf(param);
            IntPtr param_ptr    = Marshal.AllocHGlobal(nSizeOfParam);

            try
            {
                Marshal.StructureToPtr(param, param_ptr, false);
                var user_ptr = NimUtility.DelegateConverter.ConvertToIntPtr(cb);
                SignalingNativeMethods.nim_signaling_call(param_ptr, NimSignalingCallCb, user_ptr);
            }
            catch (Exception ex)
            {
            }
            finally
            {
                Marshal.FreeHGlobal(param_ptr);
            }
        }
コード例 #2
0
        /// <summary>
        /// 独立信令 呼叫接口
        /// 用于用户新开一个频道并邀请对方加入频道,如果返回码不是200、10201、10202时,sdk会主动关闭频道,标记接口调用失败
        /// 该接口为组合接口,等同于用户先创建频道,成功后加入频道并邀请对方
        /// </summary>
        /// <param name="param">呼叫的传入参数</param>
        /// <param name="cb">结果回调见NimSignalingDef.cs</param>
        public static void Call(NIMSignalingCallParam param, NimSignalingOptCallHandler cb)
        {
            NIMSignalingCallParam_C param_c = SignalHelper.GetNativeNIMSignalingCallParam(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_call(param_ptr, NimSignalingCallCb, user_ptr);
            }
            catch (Exception)
            {
                cb?.Invoke(NIMSignalingCallResCode.kAbnormal, null);
            }
            finally
            {
                Marshal.FreeHGlobal(param_ptr);
            }
        }