internal override bool Handle(DeviceOperationCode operationCode, Dictionary <byte, object> parameters, out string errorMessage) { if (base.Handle(operationCode, parameters, out errorMessage)) { string nickname = (string)parameters[(byte)ConnectPlayerParameterCode.Nickname]; DeviceCode deviceCode = (DeviceCode)parameters[(byte)ConnectPlayerParameterCode.DeviceCode]; Library.Player player; ReturnCode returnCode; if (subject.RequestInterface.ConnectPlayer(nickname, out player, out returnCode, out errorMessage)) { subject.AddPlayer(player, deviceCode); Dictionary <byte, object> responseParameters = new Dictionary <byte, object> { { (byte)ConnectPlayerResponseParameterCode.Nickname, player.Nickname }, { (byte)ConnectPlayerResponseParameterCode.HeadDeviceConnected, player.HeadDeviceConnected }, { (byte)ConnectPlayerResponseParameterCode.HandTakeDeviceConnected, player.HandTakeDeviceConnected }, }; SendResponse(operationCode, returnCode, errorMessage, responseParameters); } else { SendResponse(operationCode, returnCode, errorMessage, new Dictionary <byte, object>()); } return(true); } else { return(false); } }
public void SendResponse(DeviceOperationCode operationCode, ReturnCode returnCode, string debugMessage, Dictionary <byte, object> parameters) { OperationResponse response = new OperationResponse((byte)operationCode, parameters) { ReturnCode = (short)returnCode, DebugMessage = debugMessage }; peer.SendOperationResponse(response, new SendParameters()); }
protected override void OnOperationRequest(OperationRequest operationRequest, SendParameters sendParameters) { DeviceOperationCode operationCode = (DeviceOperationCode)operationRequest.OperationCode; Dictionary <byte, object> parameters = operationRequest.Parameters; string errorMessage; if (!Device.RequestManager.Operate(operationCode, parameters, out errorMessage)) { LogService.Error($"Request Fail, Guid: {Guid}\nErrorMessage: {errorMessage}"); } }
public bool Operate(DeviceOperationCode operationCode, ReturnCode returnCode, string debugMessage, Dictionary <byte, object> parameters, out string errorMessage) { if (operationTable.ContainsKey(operationCode)) { if (operationTable[operationCode].Handle(operationCode, returnCode, debugMessage, parameters, out errorMessage)) { return(true); } else { errorMessage = $"DeviceResponse Error: {operationCode} from Device: {device}\nErrorMessage: {errorMessage}"; return(false); } } else { errorMessage = $"Unknow DeviceResponse:{operationCode} from Device: {device}"; return(false); } }
internal override bool Handle(DeviceOperationCode operationCode, Dictionary <byte, object> parameters, out string errorMessage) { if (base.Handle(operationCode, parameters, out errorMessage)) { string nickname = (string)parameters[(byte)PlayerRequestParameterCode.Nickname]; PlayerOperationCode resolvedOperationCode = (PlayerOperationCode)parameters[(byte)PlayerRequestParameterCode.OperationCode]; Dictionary <byte, object> resolvedParameters = (Dictionary <byte, object>)parameters[(byte)PlayerRequestParameterCode.Parameters]; if (subject.Player.Nickname == nickname) { return(subject.Player.RequestManager.Operate(resolvedOperationCode, resolvedParameters, out errorMessage)); } else { errorMessage = $"PlayerOperation Error Player: {nickname} Not in Device: {subject}"; return(false); } } else { return(false); } }
public void SendResponse(DeviceOperationCode operationCode, ReturnCode returnCode, string debugMessage, Dictionary <byte, object> parameters) { throw new NotImplementedException(); }
public void SendRequest(DeviceOperationCode operationCode, Dictionary <byte, object> parameters) { Global.PhotonService.SendOperation(operationCode, parameters); }
public void SendRequest(DeviceOperationCode operationCode, Dictionary <byte, object> parameters) { LogService.Error($"PhotonServer SendRequest from : {peer.Device}"); }
internal void SendResponse(DeviceOperationCode operationCode, ReturnCode errorCode, string operationMessage, Dictionary <byte, object> parameters) { device.CommunicationInterface.SendResponse(operationCode, errorCode, operationMessage, parameters); }
internal void SendOperation(DeviceOperationCode operationCode, Dictionary <byte, object> parameters) { device.CommunicationInterface.SendRequest(operationCode, parameters); }
public void SendOperation(DeviceOperationCode operationCode, Dictionary <byte, object> parameters) { peer.OpCustom((byte)operationCode, parameters, true, 0, true); }