-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1700787
commit f2c5869
Showing
10 changed files
with
192 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
//----------------------------------------------------------------------- | ||
// <copyright file="VideoDeviceInfo.cs" company="P.O.S Informatique"> | ||
// Copyright (c) P.O.S Informatique. All rights reserved. | ||
// </copyright> | ||
//----------------------------------------------------------------------- | ||
|
||
namespace PosInformatique.Azure.Communication.UI.Blazor | ||
{ | ||
using System.Text.Json.Serialization; | ||
|
||
/// <summary> | ||
/// Information about a camera device. | ||
/// </summary> | ||
public class VideoDeviceInfo | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="VideoDeviceInfo"/> class. | ||
/// </summary> | ||
/// <param name="id">The id of this video device.</param> | ||
/// <param name="name">The name of this video device.</param> | ||
/// <param name="deviceType">The video device type.</param> | ||
public VideoDeviceInfo(string id, string name, VideoDeviceType deviceType) | ||
{ | ||
this.Id = id; | ||
this.Name = name; | ||
this.DeviceType = deviceType; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the name of this video device. | ||
/// </summary> | ||
[JsonPropertyName("name")] | ||
[JsonPropertyOrder(1)] | ||
public string Name { get; } | ||
|
||
/// <summary> | ||
/// Gets the id of this video device. | ||
/// </summary> | ||
[JsonPropertyName("id")] | ||
[JsonPropertyOrder(2)] | ||
public string Id { get; } | ||
|
||
/// <summary> | ||
/// Gets the video device type. | ||
/// </summary> | ||
[JsonPropertyName("deviceType")] | ||
[JsonPropertyOrder(3)] | ||
[JsonConverter(typeof(JsonStringEnumConverter))] | ||
public VideoDeviceType DeviceType { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//----------------------------------------------------------------------- | ||
// <copyright file="VideoDeviceType.cs" company="P.O.S Informatique"> | ||
// Copyright (c) P.O.S Informatique. All rights reserved. | ||
// </copyright> | ||
//----------------------------------------------------------------------- | ||
|
||
namespace PosInformatique.Azure.Communication.UI.Blazor | ||
{ | ||
/// <summary> | ||
/// Type of a video device. | ||
/// </summary> | ||
public enum VideoDeviceType | ||
{ | ||
/// <summary> | ||
/// The type of the device can not be determined. | ||
/// </summary> | ||
Unknown = 0, | ||
|
||
/// <summary> | ||
/// The camera is simple USB camera. | ||
/// </summary> | ||
UsbCamera = 1, | ||
|
||
/// <summary> | ||
/// The camera is a capture adapter. | ||
/// </summary> | ||
CaptureAdapter = 2, | ||
|
||
/// <summary> | ||
/// The camera is virtual (simulated by the host device). | ||
/// </summary> | ||
Virtual = 3, | ||
|
||
/// <summary> | ||
/// The camera is a screen sharing. | ||
/// </summary> | ||
ScreenSharing = 4, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
tests/Communication.UI.Blazor.Tests/Calling/VideoDeviceInfoTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
//----------------------------------------------------------------------- | ||
// <copyright file="VideoDeviceInfoTest.cs" company="P.O.S Informatique"> | ||
// Copyright (c) P.O.S Informatique. All rights reserved. | ||
// </copyright> | ||
//----------------------------------------------------------------------- | ||
|
||
namespace PosInformatique.Azure.Communication.UI.Blazor.Tests | ||
{ | ||
public class VideoDeviceInfoTest | ||
{ | ||
[Fact] | ||
public void Constructor() | ||
{ | ||
var deviceInfo = new VideoDeviceInfo("The id", "The name", VideoDeviceType.CaptureAdapter); | ||
|
||
deviceInfo.DeviceType.Should().Be(VideoDeviceType.CaptureAdapter); | ||
deviceInfo.Id.Should().Be("The id"); | ||
deviceInfo.Name.Should().Be("The name"); | ||
} | ||
|
||
[Fact] | ||
public void Serialization() | ||
{ | ||
var deviceInfo = new VideoDeviceInfo("The id", "The name", VideoDeviceType.CaptureAdapter); | ||
|
||
deviceInfo.Should().BeJsonSerializableInto(new | ||
{ | ||
name = "The name", | ||
id = "The id", | ||
deviceType = "CaptureAdapter", | ||
}); | ||
} | ||
|
||
[Fact] | ||
public void Deserialization() | ||
{ | ||
var json = new | ||
{ | ||
name = "The name", | ||
id = "The id", | ||
deviceType = "CaptureAdapter", | ||
}; | ||
|
||
json.Should().BeJsonDeserializableInto(new VideoDeviceInfo("The id", "The name", VideoDeviceType.CaptureAdapter)); | ||
} | ||
} | ||
} |