using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.EthernetCommunication;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common.Codec;
namespace PepperDash.Essentials.AppServer.Messengers
{
public class Ddvc01VtcMessenger : MessengerBase
{
BasicTriList EISC;
/********* Bools *********/
///
/// 724
///
const uint BDialHangup = 724;
///
/// 750
///
const uint BCallIncoming = 750;
///
/// 751
///
const uint BIncomingAnswer = 751;
///
/// 752
///
const uint BIncomingReject = 752;
///
/// 741
///
const uint BSpeedDial1 = 741;
///
/// 742
///
const uint BSpeedDial2 = 742;
///
/// 743
///
const uint BSpeedDial3 = 743;
///
/// 744
///
const uint BSpeedDial4 = 744;
///
/// 800
///
const uint BDirectorySearchBusy = 800;
///
/// 801
///
const uint BDirectoryLineSelected = 801;
///
/// 801 when selected entry is a contact
///
const uint BDirectoryEntryIsContact = 801;
///
/// 802 To show/hide back button
///
const uint BDirectoryIsRoot = 802;
///
/// 803 Pulse from system to inform us when directory is ready
///
const uint DDirectoryHasChanged = 803;
///
/// 804
///
const uint BDirectoryRoot = 804;
///
/// 805
///
const uint BDirectoryFolderBack = 805;
///
/// 811
///
const uint BCameraControlUp = 811;
///
/// 812
///
const uint BCameraControlDown = 812;
///
/// 813
///
const uint BCameraControlLeft = 813;
///
/// 814
///
const uint BCameraControlRight = 814;
///
/// 815
///
const uint BCameraControlZoomIn = 815;
///
/// 816
///
const uint BCameraControlZoomOut = 816;
///
/// 821 - 826
///
const uint BCameraPresetStart = 821;
/********* Ushorts *********/
///
/// 801
///
const uint UDirectorySelectRow = 801;
///
/// 801
///
const uint UDirectoryRowCount = 801;
/********* Strings *********/
///
/// 701
///
const uint SCurrentDialString = 701;
///
/// 702
///
const uint SCurrentCallName = 702;
///
/// 703
///
const uint SCurrentCallNumber = 703;
///
/// 731
///
const uint SHookState = 731;
///
/// 722
///
const uint SCallDirection = 722;
///
/// 751
///
const uint SIncomingCallName = 751;
///
/// 752
///
const uint SIncomingCallNumber = 752;
///
/// 800
///
const uint SDirectorySearchString = 800;
///
/// 801-1055
///
const uint SDirectoryEntriesStart = 801;
///
/// 1056
///
const uint SDirectoryEntrySelectedName = 1056;
///
/// 1057
///
const uint SDirectoryEntrySelectedNumber = 1057;
///
/// 701-712 0-9*#
///
Dictionary DTMFMap = new Dictionary
{
{ "1", 701 },
{ "2", 702 },
{ "3", 703 },
{ "4", 704 },
{ "5", 705 },
{ "6", 706 },
{ "7", 707 },
{ "8", 708 },
{ "9", 709 },
{ "0", 710 },
{ "*", 711 },
{ "#", 712 },
};
CodecActiveCallItem CurrentCallItem;
CodecActiveCallItem IncomingCallItem;
ushort PreviousDirectoryLength = 0;
///
///
///
///
///
public Ddvc01VtcMessenger(string key, BasicTriList eisc, string messagePath)
: base(key, messagePath)
{
EISC = eisc;
CurrentCallItem = new CodecActiveCallItem();
CurrentCallItem.Type = eCodecCallType.Video;
CurrentCallItem.Id = "-video-";
}
///
///
///
void SendFullStatus()
{
this.PostStatusMessage(new
{
calls = GetCurrentCallList(),
currentCallString = EISC.GetString(SCurrentCallNumber),
currentDialString = EISC.GetString(SCurrentDialString),
isInCall = EISC.GetString(SHookState) == "Connected",
hasDirectory = true,
hasRecents = true,
hasCameras = true
});
}
void PostDirectory()
{
var u = EISC.GetUshort(UDirectoryRowCount);
var items = new List