Skip to content

Commit

Permalink
fix: update to camera parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Trevor Payne committed Oct 19, 2022
1 parent 966385a commit 4d50875
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/CiscoRoomOsCodec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2100,7 +2100,7 @@ private void ParseStatusObject(JToken statusToken)
var selfviewToken = statusToken.SelectToken("Video.Selfview.Mode");
var mediaChannelsToken = statusToken.SelectToken("MediaChannels.Call");
var systemUnitToken = statusToken.SelectToken("SystemUnit");
var cameraToken = statusToken.SelectToken("Camera");
var cameraToken = statusToken.SelectToken("Cameras");
var networkToken = statusToken.SelectToken("Network");
var sipToken = statusToken.SelectToken("Sip");
var conferenceToken = statusToken.SelectToken("Conference");
Expand Down
41 changes: 36 additions & 5 deletions src/CiscoWebsocketClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace epi_videoCodec_ciscoExtended
public class CiscoWebsocketClient : IKeyed
{
public int IdTracker { get; private set; }
private readonly HttpsClient _client;
private readonly WebSocketClient _client;
public string Key { get; private set; }
private readonly CrestronQueue<Action> _requestQueue = new CrestronQueue<Action>(20);
private readonly ControlPropertiesConfig _config;
Expand All @@ -39,10 +39,41 @@ public CiscoWebsocketClient(string key, ControlPropertiesConfig controlConfig)

Key = string.Format("{0}-{1}-websocket", key, _config.Method).ToLower();

_client = new HttpsClient
{
IncludeHeaders = true,
};


_client =
new WebSocketClient()
{
URL = String.Format("wss://{0}:{1}@{2}/ws", _config.TcpSshProperties.Username,
_config.TcpSshProperties.Password, _config.TcpSshProperties.Address),
KeepAlive = true,
ConnectionCallBack = WebsocketConnected,
DisconnectCallBack = WebsocketDisconnected,
ReceiveCallBack = WebsocketReceiveCallback
};
_client.ConnectAsync();
}

public int WebsocketConnected(WebSocketClient.WEBSOCKET_RESULT_CODES error)
{
Debug.Console(1, this, "Websocket Connected Result = {0}", error);
return (int)error;
}

public int WebsocketDisconnected(WebSocketClient.WEBSOCKET_RESULT_CODES error, object item)
{
Debug.Console(1, this, "Websocket Disconnected Result = {0}", error);
return (int)error;
}

public int WebsocketReceiveCallback(byte[] data, uint dataLen,
WebSocketClient.WEBSOCKET_PACKET_TYPES opcode, WebSocketClient.WEBSOCKET_RESULT_CODES error)
{
if (opcode != WebSocketClient.WEBSOCKET_PACKET_TYPES.LWS_WS_OPCODE_07__TEXT_FRAME) return (int) error;
var strData = Encoding.ASCII.GetString(data, 0, data.Length);
Debug.Console(0, this, "Incoming Data Packet From Websocket");
Debug.Console(0, this, "{0}", strData);
return (int) error;
}

/*
Expand Down

0 comments on commit 4d50875

Please sign in to comment.