|
@@ -59,6 +59,7 @@ namespace WingDeviceService.Service
|
|
|
private int _liveConsultationRateSeconds = 0;
|
|
|
private bool _isRTCSelf = false;
|
|
|
private int _sdkAppId = 0;
|
|
|
+ private int _remoteControlAskTimeoutSec = 0;
|
|
|
|
|
|
/// <summary>
|
|
|
/// Init service
|
|
@@ -86,6 +87,7 @@ namespace WingDeviceService.Service
|
|
|
{
|
|
|
_sdkAppId = sdkAppId;
|
|
|
}
|
|
|
+ _remoteControlAskTimeoutSec = ConfigurationManager.GetParammeter<IntParameter>("Device", "RemoteControlAskTimeoutSec").Value;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -709,7 +711,8 @@ namespace WingDeviceService.Service
|
|
|
MergedChannel = deviceInfo.MergedChannel,
|
|
|
MergedVideoOutputWidth = deviceInfo.MergedVideoOutputWidth,
|
|
|
MergedVideoOutputHeight = deviceInfo.MergedVideoOutputHeight,
|
|
|
- IsSelfRtcService = _isRTCSelf
|
|
|
+ IsSelfRtcService = _isRTCSelf,
|
|
|
+ RemoteControlAskTimeoutSec = _remoteControlAskTimeoutSec
|
|
|
};
|
|
|
return result;
|
|
|
}
|
|
@@ -1008,7 +1011,7 @@ namespace WingDeviceService.Service
|
|
|
Width = video.Width,
|
|
|
Height = video.Height,
|
|
|
OutputWidth = video.Width,
|
|
|
- OutputHeight = video.Height
|
|
|
+ OutputHeight = video.Height
|
|
|
};
|
|
|
if (deviceDTO.VideoDeviceInfos != null && deviceDTO.VideoDeviceInfos.Any(x => x.VideoDeviceId == video.VideoDeviceId))
|
|
|
{
|
|
@@ -1185,6 +1188,82 @@ namespace WingDeviceService.Service
|
|
|
RoomNo = intRoomNo,
|
|
|
};
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 拒绝远程控制
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<bool> RejectRemoteControl(RemoteControlRequest request)
|
|
|
+ {
|
|
|
+ string deviceCode = await GetClientIdByTokenAsync(request.Token);
|
|
|
+ string userCode = request.ControlUserCode;
|
|
|
+ //发送控制人通知
|
|
|
+ if (string.IsNullOrWhiteSpace(userCode))
|
|
|
+ {
|
|
|
+ ThrowCustomerException(CustomerRpcCode.UsercodeIsEmpty, "User code is empty");
|
|
|
+ }
|
|
|
+ var userDTO = await _userServiceProxy.FindUserByCodeAsync(userCode);
|
|
|
+ if (userDTO == null)
|
|
|
+ {
|
|
|
+ ThrowCustomerException(CustomerRpcCode.UserNotExistError, "User does not exist");
|
|
|
+ }
|
|
|
+ var notify = new DeviceRejectRemoteControlNotification()
|
|
|
+ {
|
|
|
+ DeviceCode = deviceCode,
|
|
|
+ };
|
|
|
+ var notificationRequest = new SendNotificationRequest()
|
|
|
+ {
|
|
|
+ ClientId = userCode,
|
|
|
+ Message = notify,
|
|
|
+ JsonMessage = Newtonsoft.Json.JsonConvert.SerializeObject(notify),
|
|
|
+ NotificationType = notify.NotificationType,
|
|
|
+ TransactionType = TransactionTypeEnum.RemoteControl,
|
|
|
+ RelevanceCode = userCode,
|
|
|
+ ReceiverType = ApplicantTypeEnum.Client
|
|
|
+ };
|
|
|
+ await _notificationService.PostMessageAsync(notificationRequest);
|
|
|
+ //todo 更改房间调参状态 1 根据设备code获取房间 2 修改房间内某个人的调参状态
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 断开远程控制
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="request"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public async Task<bool> DisconnectRemoteControl(RemoteControlRequest request)
|
|
|
+ {
|
|
|
+ string deviceCode = await GetClientIdByTokenAsync(request.Token);
|
|
|
+ string userCode = request.ControlUserCode;
|
|
|
+ //发送控制人通知
|
|
|
+ if (string.IsNullOrWhiteSpace(userCode))
|
|
|
+ {
|
|
|
+ ThrowCustomerException(CustomerRpcCode.UsercodeIsEmpty, "User code is empty");
|
|
|
+ }
|
|
|
+ var userDTO = await _userServiceProxy.FindUserByCodeAsync(userCode);
|
|
|
+ if (userDTO == null)
|
|
|
+ {
|
|
|
+ ThrowCustomerException(CustomerRpcCode.UserNotExistError, "User does not exist");
|
|
|
+ }
|
|
|
+ var notify = new DeviceDisconnectRemoteControlNotification()
|
|
|
+ {
|
|
|
+ DeviceCode = deviceCode,
|
|
|
+ };
|
|
|
+ var notificationRequest = new SendNotificationRequest()
|
|
|
+ {
|
|
|
+ ClientId = userCode,
|
|
|
+ Message = notify,
|
|
|
+ JsonMessage = Newtonsoft.Json.JsonConvert.SerializeObject(notify),
|
|
|
+ NotificationType = notify.NotificationType,
|
|
|
+ TransactionType = TransactionTypeEnum.RemoteControl,
|
|
|
+ RelevanceCode = userCode,
|
|
|
+ ReceiverType = ApplicantTypeEnum.Client
|
|
|
+ };
|
|
|
+ await _notificationService.PostMessageAsync(notificationRequest);
|
|
|
+ //todo 更改房间调参状态 1 根据设备code获取房间 2 修改房间内某个人的调参状态
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|