mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 12:44:58 +00:00
Added directory browsing things for DDVC01
This commit is contained in:
@@ -70,6 +70,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
const uint DDirectoryHasChanged = 803;
|
const uint DDirectoryHasChanged = 803;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// 804
|
||||||
|
/// </summary>
|
||||||
|
const uint BDirectoryRoot = 804;
|
||||||
|
/// <summary>
|
||||||
|
/// 805
|
||||||
|
/// </summary>
|
||||||
|
const uint BDirectoryFolderBack = 805;
|
||||||
|
/// <summary>
|
||||||
/// 811
|
/// 811
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const uint BCameraControlUp = 811;
|
const uint BCameraControlUp = 811;
|
||||||
@@ -116,11 +124,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 702
|
/// 702
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const uint SCurrentCallNumber = 702;
|
const uint SCurrentCallName = 702;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 703
|
/// 703
|
||||||
/// </summary>
|
/// </summary>
|
||||||
const uint SCurrentCallName = 703;
|
const uint SCurrentCallNumber = 703;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 731
|
/// 731
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -176,6 +184,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
|
|
||||||
CodecActiveCallItem CurrentCallItem;
|
CodecActiveCallItem CurrentCallItem;
|
||||||
CodecActiveCallItem IncomingCallItem;
|
CodecActiveCallItem IncomingCallItem;
|
||||||
|
ushort PreviousDirectoryLength = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -209,16 +218,55 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PostDirectory()
|
||||||
|
{
|
||||||
|
var u = EISC.GetUshort(UDirectoryRowCount);
|
||||||
|
var items = new List<object>();
|
||||||
|
for (uint i = 0; i < u; i++)
|
||||||
|
{
|
||||||
|
var name = EISC.GetString(SDirectoryEntriesStart + i);
|
||||||
|
var id = (i + 1).ToString();
|
||||||
|
// is folder or contact?
|
||||||
|
if(name.StartsWith("[+]"))
|
||||||
|
{
|
||||||
|
items.Add(new
|
||||||
|
{
|
||||||
|
folderId = id,
|
||||||
|
name = name
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
items.Add(new
|
||||||
|
{
|
||||||
|
contactId = id,
|
||||||
|
name = name
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var directoryMessage = new
|
||||||
|
{
|
||||||
|
currentDirectory = new
|
||||||
|
{
|
||||||
|
isRootDirectory = EISC.GetBool(BDirectoryIsRoot),
|
||||||
|
directoryResults = items
|
||||||
|
}
|
||||||
|
};
|
||||||
|
PostStatusMessage(directoryMessage);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="appServerController"></param>
|
/// <param name="appServerController"></param>
|
||||||
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
|
protected override void CustomRegisterWithAppServer(CotijaSystemController appServerController)
|
||||||
{
|
{
|
||||||
|
var asc = appServerController;
|
||||||
EISC.SetStringSigAction(SHookState, s =>
|
EISC.SetStringSigAction(SHookState, s =>
|
||||||
{
|
{
|
||||||
CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true);
|
CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true);
|
||||||
SendCallsList();
|
SendFullStatus(); // SendCallsList();
|
||||||
});
|
});
|
||||||
|
|
||||||
EISC.SetStringSigAction(SCurrentCallNumber, s =>
|
EISC.SetStringSigAction(SCurrentCallNumber, s =>
|
||||||
@@ -264,39 +312,30 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
// Directory insanity
|
// Directory insanity
|
||||||
EISC.SetUShortSigAction(UDirectoryRowCount, u =>
|
EISC.SetUShortSigAction(UDirectoryRowCount, u =>
|
||||||
{
|
{
|
||||||
var items = new List<object>();
|
// The length of the list comes in before the list does.
|
||||||
for (uint i = 0; i < u; i++)
|
// Splice the sig change operation onto the last string sig that will be changing
|
||||||
|
// when the directory entries make it through.
|
||||||
|
if (PreviousDirectoryLength > 0)
|
||||||
{
|
{
|
||||||
var newItem = new
|
EISC.ClearStringSigAction(SDirectoryEntriesStart + PreviousDirectoryLength - 1);
|
||||||
{
|
|
||||||
name = EISC.GetString(SDirectoryEntriesStart + i),
|
|
||||||
};
|
|
||||||
items.Add(newItem);
|
|
||||||
}
|
}
|
||||||
|
EISC.SetStringSigAction(SDirectoryEntriesStart + u - 1, s => PostDirectory());
|
||||||
var directoryMessage = new {
|
PreviousDirectoryLength = u;
|
||||||
content = new {
|
//PostDirectory();
|
||||||
currentDirectory = new {
|
|
||||||
isRootDirectory = EISC.GetBool(BDirectoryIsRoot),
|
|
||||||
directoryResults = items
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
PostStatusMessage(directoryMessage);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
EISC.SetStringSigAction(SDirectoryEntrySelectedName, s =>
|
EISC.SetStringSigAction(SDirectoryEntrySelectedName, s =>
|
||||||
{
|
{
|
||||||
PostStatusMessage(new { content = new { directorySelectedEntryName = EISC.GetString(SDirectoryEntrySelectedName) } });
|
PostStatusMessage(new { content = new {
|
||||||
|
directorySelectedEntryName = EISC.GetString(SDirectoryEntrySelectedName) } });
|
||||||
});
|
});
|
||||||
|
|
||||||
EISC.SetStringSigAction(SDirectoryEntrySelectedNumber, s =>
|
EISC.SetStringSigAction(SDirectoryEntrySelectedNumber, s =>
|
||||||
{
|
{
|
||||||
PostStatusMessage(new { content = new { directorySelectedEntryNumber = EISC.GetString(SDirectoryEntrySelectedNumber) } });
|
PostStatusMessage(new { content = new {
|
||||||
|
directorySelectedEntryNumber = EISC.GetString(SDirectoryEntrySelectedNumber) } });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Add press and holds using helper action
|
// Add press and holds using helper action
|
||||||
Action<string, uint> addPHAction = (s, u) =>
|
Action<string, uint> addPHAction = (s, u) =>
|
||||||
AppServerController.AddAction(MessagePath + s, new PressAndHoldAction(b => EISC.SetBool(u, b)));
|
AppServerController.AddAction(MessagePath + s, new PressAndHoldAction(b => EISC.SetBool(u, b)));
|
||||||
@@ -310,7 +349,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
// Add straight pulse calls using helper action
|
// Add straight pulse calls using helper action
|
||||||
Action<string, uint> addAction = (s, u) =>
|
Action<string, uint> addAction = (s, u) =>
|
||||||
AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100)));
|
AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100)));
|
||||||
addAction("/endCallById", BDialHangup);
|
addAction("/endCallById", BDialHangup);
|
||||||
addAction("/acceptById", BIncomingAnswer);
|
addAction("/acceptById", BIncomingAnswer);
|
||||||
addAction("/rejectById", BIncomingReject);
|
addAction("/rejectById", BIncomingReject);
|
||||||
addAction("/speedDial1", BSpeedDial1);
|
addAction("/speedDial1", BSpeedDial1);
|
||||||
@@ -322,12 +361,13 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
addAction("/cameraPreset" + (i + 1), BCameraPresetStart + i);
|
addAction("/cameraPreset" + (i + 1), BCameraPresetStart + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
asc.AddAction(MessagePath + "/isReady", new Action(SendIsReady));
|
||||||
// Get status
|
// Get status
|
||||||
AppServerController.AddAction(MessagePath + "/fullStatus", new Action(SendFullStatus));
|
asc.AddAction(MessagePath + "/fullStatus", new Action(SendFullStatus));
|
||||||
// Dial on string
|
// Dial on string
|
||||||
AppServerController.AddAction(MessagePath + "/dial", new Action<string>(s => EISC.SetString(SCurrentDialString, s)));
|
asc.AddAction(MessagePath + "/dial", new Action<string>(s => EISC.SetString(SCurrentDialString, s)));
|
||||||
// Pulse DTMF
|
// Pulse DTMF
|
||||||
AppServerController.AddAction(MessagePath + "/dtmf", new Action<string>(s =>
|
asc.AddAction(MessagePath + "/dtmf", new Action<string>(s =>
|
||||||
{
|
{
|
||||||
if (DTMFMap.ContainsKey(s))
|
if (DTMFMap.ContainsKey(s))
|
||||||
{
|
{
|
||||||
@@ -336,14 +376,69 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
// Directory madness
|
// Directory madness
|
||||||
AppServerController.AddAction(MessagePath + "/directorySelectLine", new Action<ushort>(u =>
|
asc.AddAction(MessagePath + "/directoryRoot", new Action(() => EISC.PulseBool(BDirectoryRoot)));
|
||||||
|
asc.AddAction(MessagePath + "/directoryBack", new Action(() => EISC.PulseBool(BDirectoryFolderBack)));
|
||||||
|
asc.AddAction(MessagePath + "/directoryById", new Action<string>(s =>
|
||||||
{
|
{
|
||||||
EISC.SetUshort(UDirectorySelectRow, u);
|
// the id should contain the line number to forward to simpl
|
||||||
EISC.PulseBool(BDirectoryLineSelected);
|
try
|
||||||
}));
|
{
|
||||||
|
var u = ushort.Parse(s);
|
||||||
|
EISC.SetUshort(UDirectorySelectRow, u);
|
||||||
|
EISC.PulseBool(BDirectoryLineSelected);
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, Debug.ErrorLogLevel.Warning,
|
||||||
|
"/directoryById request contains non-numeric ID incompatible with DDVC bridge");
|
||||||
|
}
|
||||||
|
|
||||||
|
}));
|
||||||
|
asc.AddAction(MessagePath + "/directorySelectContact", new Action<string>(s =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var u = ushort.Parse(s);
|
||||||
|
EISC.SetUshort(UDirectorySelectRow, u);
|
||||||
|
EISC.PulseBool(BDirectoryLineSelected);
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
asc.AddAction(MessagePath + "/getDirectory", new Action(() =>
|
||||||
|
{
|
||||||
|
if (EISC.GetUshort(UDirectoryRowCount) > 0)
|
||||||
|
{
|
||||||
|
PostDirectory();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
EISC.PulseBool(BDirectoryRoot);
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
//asc.AddAction(MessagePath + "/directorySelectLine", new Action<ushort>(u =>
|
||||||
|
//{
|
||||||
|
// EISC.SetUshort(UDirectorySelectRow, u);
|
||||||
|
// EISC.PulseBool(BDirectoryLineSelected);
|
||||||
|
//}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
void SendIsReady()
|
||||||
|
{
|
||||||
|
PostStatusMessage(new
|
||||||
|
{
|
||||||
|
isReady = true
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
void SendCallsList()
|
void SendCallsList()
|
||||||
{
|
{
|
||||||
PostStatusMessage(new
|
PostStatusMessage(new
|
||||||
|
|||||||
@@ -30,7 +30,11 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
Debug.Console(1, comm, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
Debug.Console(1, comm, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
// this is a permanent event handler. This cannot be -= from event
|
// this is a permanent event handler. This cannot be -= from event
|
||||||
comm.CommPort.TextReceived += (s, a) => trilist.SetString(joinMap.TextReceived, a.Text);
|
comm.CommPort.TextReceived += (s, a) =>
|
||||||
|
{
|
||||||
|
Debug.Console(2, comm, "RX: {0}", a.Text);
|
||||||
|
trilist.SetString(joinMap.TextReceived, a.Text);
|
||||||
|
};
|
||||||
trilist.SetStringSigAction(joinMap.SendText, new Action<string>(s => comm.CommPort.SendText(s)));
|
trilist.SetStringSigAction(joinMap.SendText, new Action<string>(s => comm.CommPort.SendText(s)));
|
||||||
trilist.SetStringSigAction(joinMap.SetPortConfig + 1, new Action<string>(s => comm.SetPortConfig(s)));
|
trilist.SetStringSigAction(joinMap.SetPortConfig + 1, new Action<string>(s => comm.SetPortConfig(s)));
|
||||||
|
|
||||||
|
|||||||
@@ -30,4 +30,8 @@ devjson:1 {"deviceKey":"room1.InCallFeedback","methodName":"SetTestValue", "para
|
|||||||
|
|
||||||
devjson:1 {"deviceKey":"room1.InCallFeedback","methodName":"ClearTestValue", "params": []}
|
devjson:1 {"deviceKey":"room1.InCallFeedback","methodName":"ClearTestValue", "params": []}
|
||||||
|
|
||||||
devjson:3 {"deviceKey":"room1.RoomOccupancy.RoomIsOccupiedFeedback","methodName":"SetTestValue", "params": [ true ]}
|
devjson:3 {"deviceKey":"room1.RoomOccupancy.RoomIsOccupiedFeedback","methodName":"SetTestValue", "params": [ true ]}
|
||||||
|
|
||||||
|
devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"SendText", "params": ["xcommand dial number: 10.11.50.211\r"]}
|
||||||
|
|
||||||
|
devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"Connect", "params": []}
|
||||||
Reference in New Issue
Block a user