예제 #1
0
        /// <summary>
        /// 独立信令 加入频道接口
        /// </summary>
        /// <param name="param">加入频道的传入参数</param>
        /// <param name="cb">结果回调见NimSignalingDef.cs</param>
        public static void Join(NIMSignalingJoinParam param, NimSignalingOptJoinHandler cb)
        {
            NIMSignalingJoinParam_C param_c = SignalHelper.GetNativeNIMSignalingJoinParam(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_join(param_ptr, NimSignalingJoinCb, user_ptr);
            }
            catch (Exception ex)
            {
            }
            finally
            {
                Marshal.FreeHGlobal(param_ptr);
            }
        }