feat(protocol): negotiate display and native input
This commit is contained in:
+54
-7
@@ -1,6 +1,6 @@
|
||||
// Code generated by tools/generate.py; DO NOT EDIT.
|
||||
#![allow(non_snake_case)]
|
||||
pub const SCHEMA_SHA256: &str = "a86cbdaf2cfb884e3d98467968007e731ca55c6f6eb6dbd5cd6b95e062a9b058";
|
||||
pub const SCHEMA_SHA256: &str = "b2bb0a8ac8ef56dbc0e1443eeb5b3028be9e71ec2f5fd8e73928d71b7cd9340c";
|
||||
pub const CURRENT_WIRE_VERSION: &str = "1";
|
||||
pub const N_MINUS_1_WIRE_VERSION: &str = "0";
|
||||
pub const N_MINUS_2_WIRE_VERSION: &str = "-1";
|
||||
@@ -136,11 +136,13 @@ pub struct BrokerSession {
|
||||
requestedAt: String,
|
||||
endedAt: Option<String>,
|
||||
version: i64,
|
||||
requestedDisplayMode: Option<DisplayMode>,
|
||||
effectiveDisplayMode: Option<DisplayMode>,
|
||||
}
|
||||
|
||||
impl BrokerSession {
|
||||
pub fn new(id: String, principalId: String, poolId: String, assignmentId: Option<String>, state: String, policySnapshot: AllocationPolicy, reconnectDeadline: Option<String>, outcome: Option<String>, failureCode: Option<String>, cleanupState: String, idempotencyKey: String, correlationId: String, requestedAt: String, endedAt: Option<String>, version: i64) -> Result<Self, ValidationError> {
|
||||
let value = Self { id, principalId, poolId, assignmentId, state, policySnapshot, reconnectDeadline, outcome, failureCode, cleanupState, idempotencyKey, correlationId, requestedAt, endedAt, version };
|
||||
pub fn new(id: String, principalId: String, poolId: String, assignmentId: Option<String>, state: String, policySnapshot: AllocationPolicy, reconnectDeadline: Option<String>, outcome: Option<String>, failureCode: Option<String>, cleanupState: String, idempotencyKey: String, correlationId: String, requestedAt: String, endedAt: Option<String>, version: i64, requestedDisplayMode: Option<DisplayMode>, effectiveDisplayMode: Option<DisplayMode>) -> Result<Self, ValidationError> {
|
||||
let value = Self { id, principalId, poolId, assignmentId, state, policySnapshot, reconnectDeadline, outcome, failureCode, cleanupState, idempotencyKey, correlationId, requestedAt, endedAt, version, requestedDisplayMode, effectiveDisplayMode };
|
||||
value.validate()?;
|
||||
Ok(value)
|
||||
}
|
||||
@@ -184,6 +186,12 @@ impl BrokerSession {
|
||||
if value.len() > 64 { return Err(ValidationError::new("ended_at", "max_length")); }
|
||||
}
|
||||
if self.version < 1 { return Err(ValidationError::new("version", "minimum")); }
|
||||
if let Some(value) = &self.requestedDisplayMode {
|
||||
value.validate().map_err(|_| ValidationError::new("requested_display_mode", "invalid_object"))?;
|
||||
}
|
||||
if let Some(value) = &self.effectiveDisplayMode {
|
||||
value.validate().map_err(|_| ValidationError::new("effective_display_mode", "invalid_object"))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
pub fn id(&self) -> &String { &self.id }
|
||||
@@ -201,6 +209,8 @@ impl BrokerSession {
|
||||
pub fn requestedAt(&self) -> &String { &self.requestedAt }
|
||||
pub fn endedAt(&self) -> &Option<String> { &self.endedAt }
|
||||
pub fn version(&self) -> &i64 { &self.version }
|
||||
pub fn requestedDisplayMode(&self) -> &Option<DisplayMode> { &self.requestedDisplayMode }
|
||||
pub fn effectiveDisplayMode(&self) -> &Option<DisplayMode> { &self.effectiveDisplayMode }
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
@@ -494,6 +504,33 @@ impl DeviceRegistrationRequest {
|
||||
pub fn publicKey(&self) -> &String { &self.publicKey }
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct DisplayMode {
|
||||
resolutionWidth: i64,
|
||||
resolutionHeight: i64,
|
||||
fps: i64,
|
||||
}
|
||||
|
||||
impl DisplayMode {
|
||||
pub fn new(resolutionWidth: i64, resolutionHeight: i64, fps: i64) -> Result<Self, ValidationError> {
|
||||
let value = Self { resolutionWidth, resolutionHeight, fps };
|
||||
value.validate()?;
|
||||
Ok(value)
|
||||
}
|
||||
pub fn validate(&self) -> Result<(), ValidationError> {
|
||||
if self.resolutionWidth < 320 { return Err(ValidationError::new("resolution_width", "minimum")); }
|
||||
if self.resolutionWidth > 16384 { return Err(ValidationError::new("resolution_width", "maximum")); }
|
||||
if self.resolutionHeight < 200 { return Err(ValidationError::new("resolution_height", "minimum")); }
|
||||
if self.resolutionHeight > 8640 { return Err(ValidationError::new("resolution_height", "maximum")); }
|
||||
if self.fps < 1 { return Err(ValidationError::new("fps", "minimum")); }
|
||||
if self.fps > 240 { return Err(ValidationError::new("fps", "maximum")); }
|
||||
Ok(())
|
||||
}
|
||||
pub fn resolutionWidth(&self) -> &i64 { &self.resolutionWidth }
|
||||
pub fn resolutionHeight(&self) -> &i64 { &self.resolutionHeight }
|
||||
pub fn fps(&self) -> &i64 { &self.fps }
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct EntitledPool {
|
||||
poolId: String,
|
||||
@@ -1080,11 +1117,12 @@ impl ManifestGateway {
|
||||
pub struct ManifestProfile {
|
||||
id: String,
|
||||
bounds: ManifestBounds,
|
||||
displayMode: Option<DisplayMode>,
|
||||
}
|
||||
|
||||
impl ManifestProfile {
|
||||
pub fn new(id: String, bounds: ManifestBounds) -> Result<Self, ValidationError> {
|
||||
let value = Self { id, bounds };
|
||||
pub fn new(id: String, bounds: ManifestBounds, displayMode: Option<DisplayMode>) -> Result<Self, ValidationError> {
|
||||
let value = Self { id, bounds, displayMode };
|
||||
value.validate()?;
|
||||
Ok(value)
|
||||
}
|
||||
@@ -1093,10 +1131,14 @@ impl ManifestProfile {
|
||||
if !self.id.is_empty() && self.id.len() < 1 { return Err(ValidationError::new("id", "min_length")); }
|
||||
if self.id.len() > 128 { return Err(ValidationError::new("id", "max_length")); }
|
||||
self.bounds.validate().map_err(|_| ValidationError::new("bounds", "invalid_object"))?;
|
||||
if let Some(value) = &self.displayMode {
|
||||
value.validate().map_err(|_| ValidationError::new("display_mode", "invalid_object"))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
pub fn id(&self) -> &String { &self.id }
|
||||
pub fn bounds(&self) -> &ManifestBounds { &self.bounds }
|
||||
pub fn displayMode(&self) -> &Option<DisplayMode> { &self.displayMode }
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
@@ -1613,11 +1655,12 @@ pub struct SessionRequest {
|
||||
poolId: String,
|
||||
idempotencyKey: String,
|
||||
policySnapshot: AllocationPolicy,
|
||||
requestedDisplayMode: Option<DisplayMode>,
|
||||
}
|
||||
|
||||
impl SessionRequest {
|
||||
pub fn new(clientDeviceId: String, deviceKeyId: String, poolId: String, idempotencyKey: String, policySnapshot: AllocationPolicy) -> Result<Self, ValidationError> {
|
||||
let value = Self { clientDeviceId, deviceKeyId, poolId, idempotencyKey, policySnapshot };
|
||||
pub fn new(clientDeviceId: String, deviceKeyId: String, poolId: String, idempotencyKey: String, policySnapshot: AllocationPolicy, requestedDisplayMode: Option<DisplayMode>) -> Result<Self, ValidationError> {
|
||||
let value = Self { clientDeviceId, deviceKeyId, poolId, idempotencyKey, policySnapshot, requestedDisplayMode };
|
||||
value.validate()?;
|
||||
Ok(value)
|
||||
}
|
||||
@@ -1635,6 +1678,9 @@ impl SessionRequest {
|
||||
if !self.idempotencyKey.is_empty() && self.idempotencyKey.len() < 1 { return Err(ValidationError::new("idempotency_key", "min_length")); }
|
||||
if self.idempotencyKey.len() > 256 { return Err(ValidationError::new("idempotency_key", "max_length")); }
|
||||
self.policySnapshot.validate().map_err(|_| ValidationError::new("policy_snapshot", "invalid_object"))?;
|
||||
if let Some(value) = &self.requestedDisplayMode {
|
||||
value.validate().map_err(|_| ValidationError::new("requested_display_mode", "invalid_object"))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
pub fn clientDeviceId(&self) -> &String { &self.clientDeviceId }
|
||||
@@ -1642,6 +1688,7 @@ impl SessionRequest {
|
||||
pub fn poolId(&self) -> &String { &self.poolId }
|
||||
pub fn idempotencyKey(&self) -> &String { &self.idempotencyKey }
|
||||
pub fn policySnapshot(&self) -> &AllocationPolicy { &self.policySnapshot }
|
||||
pub fn requestedDisplayMode(&self) -> &Option<DisplayMode> { &self.requestedDisplayMode }
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
|
||||
Reference in New Issue
Block a user