private async Task CameraComponentGetAllFormats(MessageContainer data) { uint width; uint height; uint bitrate; string type = data.ResolveParameter("Type", 0); string subtype = data.ResolveParameter("SubType", 1); if (!uint.TryParse(data.ResolveParameter("Width", 2), out width)) { width = 0; } if (!uint.TryParse(data.ResolveParameter("Height", 3), out height)) { height = 0; } if (!uint.TryParse(data.ResolveParameter("BitRate", 4), out bitrate)) { bitrate = 0; } foreach (var item in await GetSupportedMediaFormats(type, subtype, width, height, bitrate).ConfigureAwait(false)) { data.AddMultiPartValue("MediaFormat", MediaPropertiesToJson(item)); } await ComponentHandler.HandleOutput(data).ConfigureAwait(false); }
private async Task CameraComponentCapture(MessageContainer data) { string imageBase64 = string.Empty; using (IRandomAccessStream stream = await CaptureMediaStream(ImageEncodingProperties.CreateJpeg()).ConfigureAwait(false)) { byte[] bytes = new byte[stream.Size]; using (DataReader reader = new DataReader(stream)) { await reader.LoadAsync((uint)stream.Size); reader.ReadBytes(bytes); } imageBase64 = Convert.ToBase64String(bytes); } data.AddValue("ImageBase64", imageBase64); await ComponentHandler.HandleOutput(data).ConfigureAwait(false); }
private async Task TurnTableComponentGet(MessageContainer data) { data.AddValue("Position", servo.Position); await ComponentHandler.HandleOutput(data).ConfigureAwait(false); }
private async Task CameraComponentGetCurrentFormat(MessageContainer data) { data.AddValue("MediaFormat", MediaPropertiesToJson(await GetCurrentFormat())); await ComponentHandler.HandleOutput(data).ConfigureAwait(false); }
private async Task ListenerGetPort(MessageContainer data) { data.AddValue("Port", this.port); await ComponentHandler.HandleOutput(data).ConfigureAwait(false); }
private async Task ListenerGetDataFormat(MessageContainer data) { data.AddValue("DataFormat", this.dataFormat.ToString()); await ComponentHandler.HandleOutput(data).ConfigureAwait(false); }