mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-08-31 19:08:29 +00:00
feat: enhance IHasDirectoryMessenger with new actions and state messaging for directory management
feat: update MobileControlConfig to enable messenger subscriptions by default fix: improve HandleBatchDeviceFullStatus to support granular device status requests and enhance error handling
This commit is contained in:
parent
77c78af74b
commit
8748157362
4 changed files with 93 additions and 28 deletions
|
|
@ -50,7 +50,7 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
};
|
||||
}
|
||||
|
||||
private void SendCurrentSourceStatus(string id = null)
|
||||
private void SendCurrentSourceStatus(string id)
|
||||
{
|
||||
var message = new CurrentSourcesStateMessage
|
||||
{
|
||||
|
|
|
|||
|
|
@ -36,12 +36,16 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
|
||||
AddAction("/getDirectory", (id, content) => GetDirectoryRoot());
|
||||
|
||||
AddAction("/setCurrentDirectoryToRoot", (id, content) => _directory.SetCurrentDirectoryToRoot());
|
||||
|
||||
AddAction("/directoryById", (id, content) =>
|
||||
{
|
||||
var msg = content.ToObject<MobileControlSimpleContent<string>>();
|
||||
GetDirectory(msg.Value);
|
||||
});
|
||||
|
||||
AddAction("/getDirectoryPareentFolderContents", (id, content) => _directory.GetDirectoryParentFolderContents());
|
||||
|
||||
AddAction("/directorySearch", (id, content) =>
|
||||
{
|
||||
var msg = content.ToObject<MobileControlSimpleContent<string>>();
|
||||
|
|
@ -52,6 +56,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
|
||||
_directory.DirectoryResultReturned += DirectoryResultReturned;
|
||||
_directory.PhonebookSyncState.InitialSyncCompleted += PhonebookSyncState_InitialSyncCompleted;
|
||||
|
||||
_directory.CurrentDirectoryResultIsNotDirectoryRoot.OutputChange += (s, e) =>
|
||||
{
|
||||
PostStatusMessage(new IHasDirectoryStateMessage
|
||||
{
|
||||
DirectorySelectedFolderIsNotRoot = _directory.CurrentDirectoryResultIsNotDirectoryRoot?.BoolValue
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
private void DirectoryResultReturned(object sender, DirectoryEventArgs e)
|
||||
|
|
@ -125,16 +137,22 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
{
|
||||
PostStatusMessage(new IHasDirectoryStateMessage
|
||||
{
|
||||
DirectoryRoot = _directory.DirectoryRoot,
|
||||
CurrentDirectory = _directory.CurrentDirectoryResult,
|
||||
InitialPhonebookSyncComplete = _directory.PhonebookSyncState.InitialSyncComplete,
|
||||
HasDirectory = true,
|
||||
HasDirectorySearch = true,
|
||||
DirectorySelectedFolderName = _directory.CurrentDirectoryResult?.CurrentDirectoryResults?.Count > 0 ? _directory.CurrentDirectoryResult.CurrentDirectoryResults[0].Name : null,
|
||||
DirectorySelectedFolderIsNotRoot = _directory.CurrentDirectorResultIsNotDirectoryRoot?.BoolValue
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public class IHasDirectoryStateMessage : DeviceStateMessageBase
|
||||
{
|
||||
[JsonProperty("directoryRoot", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public CodecDirectory DirectoryRoot { get; set; }
|
||||
|
||||
[JsonProperty("currentDirectory", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public CodecDirectory CurrentDirectory { get; set; }
|
||||
|
||||
|
|
@ -153,5 +171,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||
[JsonProperty("directorySelectedFolderName", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string DirectorySelectedFolderName { get; set; }
|
||||
|
||||
[JsonProperty("directorySelectedFolderIsNotRoot", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool? DirectorySelectedFolderIsNotRoot { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue