|
@@ -64,6 +64,7 @@ namespace WingDeviceService.Service
|
|
|
private int _liveConsultationRateSeconds = 0;
|
|
|
private bool _isRTCSelf = false;
|
|
|
private int _sdkAppId = 0;
|
|
|
+ private int _remoteControlAskTimeoutSec = 0;
|
|
|
private int _reportStateIntervalSeconds = 0;
|
|
|
private int _reportStateTimeout = 0;
|
|
|
|
|
@@ -93,6 +94,7 @@ namespace WingDeviceService.Service
|
|
|
{
|
|
|
_sdkAppId = sdkAppId;
|
|
|
}
|
|
|
+ _remoteControlAskTimeoutSec = ConfigurationManager.GetParammeter<IntParameter>("Device", "RemoteControlAskTimeoutSec").Value;
|
|
|
var _reportStateIntervalSeconds = ConfigurationManager.GetParammeter<IntParameter>("Live", "ReportStateIntervalSeconds").Value;
|
|
|
var _reportStateTimeout = ConfigurationManager.GetParammeter<IntParameter>("Live", "ReportStateTimeout").Value;
|
|
|
}
|
|
@@ -718,7 +720,8 @@ namespace WingDeviceService.Service
|
|
|
MergedChannel = deviceInfo.MergedChannel,
|
|
|
MergedVideoOutputWidth = deviceInfo.MergedVideoOutputWidth,
|
|
|
MergedVideoOutputHeight = deviceInfo.MergedVideoOutputHeight,
|
|
|
- IsSelfRtcService = _isRTCSelf
|
|
|
+ IsSelfRtcService = _isRTCSelf,
|
|
|
+ RemoteControlAskTimeoutSec = _remoteControlAskTimeoutSec
|
|
|
};
|
|
|
return result;
|
|
|
}
|
|
@@ -1312,7 +1315,6 @@ namespace WingDeviceService.Service
|
|
|
RoomNo = intRoomNo,
|
|
|
};
|
|
|
}
|
|
|
-
|
|
|
private async Task<bool> BroadcastNotificationAsync(string roomId, IList<string> clientIds, NotificationDTO message)
|
|
|
{
|
|
|
var broadcastNotificationRequest = new BroadcastRoomNotificationRequest
|
|
@@ -1327,6 +1329,82 @@ namespace WingDeviceService.Service
|
|
|
};
|
|
|
return await _rtcService.BroadcastRoomNotificationAsync(broadcastNotificationRequest);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 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);
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ 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);
|
|
|
+
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
}
|