internal SdkMsHeartBeat GetSdkSend() { var antsdkreceivemsgtypeValue = (long)MsgType; var sdkreceivemsgType = (SdkMsgType)antsdkreceivemsgtypeValue; var sdksend = new SdkMsHeartBeat { MsgType = sdkreceivemsgType, userId = userId, attr = attr }; return(sdksend); }
/// <summary> /// 方法说明:组织发送心跳消息计时 /// </summary> /// <param name="sender">计时器</param> /// <param name="e">时间间隔</param> private void _heartbeattimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { _heartbeatnumber++; //60秒发送一次心跳 if (_heartbeatnumber == 60) { var heartbeat = Task.Factory.StartNew(() => { if (IsConnected) { var sendhb = new SdkMsHeartBeat { userId = this._userId, attr = $"{SdkEnumCollection.OSType.PC.ToString()} Send HeatBeat Message" }; var temperrorMsg = string.Empty; SdkPublishTerminalMsg(sendhb, ref temperrorMsg); } }); //重置心跳计数 _heartbeatnumber = 0; } }