mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 05:05:00 +00:00
?
This commit is contained in:
@@ -474,6 +474,8 @@ namespace PepperDash.Essentials
|
|||||||
WSClient = new WebSocketClient();
|
WSClient = new WebSocketClient();
|
||||||
}
|
}
|
||||||
WSClient.URL = string.Format("wss://{0}/system/join/{1}", Config.ServerUrl, this.SystemUuid);
|
WSClient.URL = string.Format("wss://{0}/system/join/{1}", Config.ServerUrl, this.SystemUuid);
|
||||||
|
WSClient.ConnectionCallBack = ConnectCallback;
|
||||||
|
WSClient.DisconnectCallBack = DisconnectCallback;
|
||||||
WSClient.Connect();
|
WSClient.Connect();
|
||||||
Debug.Console(0, this, "Websocket connected");
|
Debug.Console(0, this, "Websocket connected");
|
||||||
WSClient.ReceiveCallBack = WebsocketReceiveCallback;
|
WSClient.ReceiveCallBack = WebsocketReceiveCallback;
|
||||||
@@ -481,6 +483,43 @@ namespace PepperDash.Essentials
|
|||||||
WSClient.ReceiveAsync();
|
WSClient.ReceiveAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Waits two and goes again
|
||||||
|
/// </summary>
|
||||||
|
void ReconnectStreamClient()
|
||||||
|
{
|
||||||
|
WSClient = null;
|
||||||
|
new CTimer(o => ConnectStreamClient(), 2000);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="code"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
int ConnectCallback(WebSocketClient.WEBSOCKET_RESULT_CODES code)
|
||||||
|
{
|
||||||
|
if (code != WebSocketClient.WEBSOCKET_RESULT_CODES.WEBSOCKET_CLIENT_SUCCESS)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Web socket connection failed: {0}", code);
|
||||||
|
ReconnectStreamClient();
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="code"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
int DisconnectCallback(WebSocketClient.WEBSOCKET_RESULT_CODES code, object o)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, Debug.ErrorLogLevel.Warning, "Websocket disconnected with code: {0}", code);
|
||||||
|
ReconnectStreamClient();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resets reconnect timer and updates usercode
|
/// Resets reconnect timer and updates usercode
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -619,7 +658,7 @@ namespace PepperDash.Essentials
|
|||||||
}
|
}
|
||||||
case "held":
|
case "held":
|
||||||
{
|
{
|
||||||
if (!PushedActions.ContainsKey(type))
|
if (PushedActions.ContainsKey(type))
|
||||||
{
|
{
|
||||||
PushedActions[type].Reset(ButtonHeartbeatInterval, ButtonHeartbeatInterval);
|
PushedActions[type].Reset(ButtonHeartbeatInterval, ButtonHeartbeatInterval);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -422,6 +422,7 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
break;
|
break;
|
||||||
var icon = EISC.StringOutput[651 + i].StringValue;
|
var icon = EISC.StringOutput[651 + i].StringValue;
|
||||||
var key = EISC.StringOutput[671 + i].StringValue;
|
var key = EISC.StringOutput[671 + i].StringValue;
|
||||||
|
|
||||||
var type = EISC.StringOutput[701 + i].StringValue;
|
var type = EISC.StringOutput[701 + i].StringValue;
|
||||||
|
|
||||||
Debug.Console(0, this, "Adding source {0} '{1}'", key, name);
|
Debug.Console(0, this, "Adding source {0} '{1}'", key, name);
|
||||||
@@ -430,6 +431,7 @@ namespace PepperDash.Essentials.Room.Cotija
|
|||||||
Name = name,
|
Name = name,
|
||||||
Order = (int)i + 1,
|
Order = (int)i + 1,
|
||||||
SourceKey = key,
|
SourceKey = key,
|
||||||
|
Type = eSourceListItemType.Route
|
||||||
};
|
};
|
||||||
newSl.Add(key, newSLI);
|
newSl.Add(key, newSLI);
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ namespace PepperDash.Essentials
|
|||||||
{
|
{
|
||||||
Parent.AddAction(string.Format(@"/room/{0}/volumes/master/level", Room.Key), new Action<ushort>(u =>
|
Parent.AddAction(string.Format(@"/room/{0}/volumes/master/level", Room.Key), new Action<ushort>(u =>
|
||||||
(volumeRoom.CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(u)));
|
(volumeRoom.CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(u)));
|
||||||
Parent.AddAction(string.Format(@"/room/{0}/volumes/master/mute", Room.Key), new Action(() =>
|
Parent.AddAction(string.Format(@"/room/{0}/volumes/master/muteToggle", Room.Key), new Action(() =>
|
||||||
volumeRoom.CurrentVolumeControls.MuteToggle()));
|
volumeRoom.CurrentVolumeControls.MuteToggle()));
|
||||||
volumeRoom.CurrentVolumeDeviceChange += new EventHandler<VolumeDeviceChangeEventArgs>(Room_CurrentVolumeDeviceChange);
|
volumeRoom.CurrentVolumeDeviceChange += new EventHandler<VolumeDeviceChangeEventArgs>(Room_CurrentVolumeDeviceChange);
|
||||||
|
|
||||||
|
|||||||
@@ -4,5 +4,5 @@
|
|||||||
[assembly: AssemblyCompany("PepperDash Technology Corp")]
|
[assembly: AssemblyCompany("PepperDash Technology Corp")]
|
||||||
[assembly: AssemblyProduct("PepperDashEssentials")]
|
[assembly: AssemblyProduct("PepperDashEssentials")]
|
||||||
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")]
|
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")]
|
||||||
[assembly: AssemblyVersion("1.2.5.*")]
|
[assembly: AssemblyVersion("1.2.6.*")]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user