mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
Merge pull request #1343 from PepperDash/device-interface-system
device interface system
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>2.15.1-local</Version>
|
<Version>2.18.2-local</Version>
|
||||||
<InformationalVersion>$(Version)</InformationalVersion>
|
<InformationalVersion>$(Version)</InformationalVersion>
|
||||||
<Authors>PepperDash Technology</Authors>
|
<Authors>PepperDash Technology</Authors>
|
||||||
<Company>PepperDash Technology</Company>
|
<Company>PepperDash Technology</Company>
|
||||||
|
|||||||
@@ -2185,6 +2185,8 @@ namespace PepperDash.Essentials
|
|||||||
};
|
};
|
||||||
|
|
||||||
SendMessageObject(message);
|
SendMessageObject(message);
|
||||||
|
|
||||||
|
SendDeviceInterfaces(clientId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2196,7 +2198,10 @@ namespace PepperDash.Essentials
|
|||||||
ClientId = clientId,
|
ClientId = clientId,
|
||||||
Content = roomKey
|
Content = roomKey
|
||||||
};
|
};
|
||||||
|
|
||||||
SendMessageObject(message);
|
SendMessageObject(message);
|
||||||
|
|
||||||
|
SendDeviceInterfaces(clientId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2214,6 +2219,8 @@ namespace PepperDash.Essentials
|
|||||||
};
|
};
|
||||||
|
|
||||||
SendMessageObject(message);
|
SendMessageObject(message);
|
||||||
|
|
||||||
|
SendDeviceInterfaces(clientId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2227,6 +2234,36 @@ namespace PepperDash.Essentials
|
|||||||
};
|
};
|
||||||
|
|
||||||
SendMessageObject(newMessage);
|
SendMessageObject(newMessage);
|
||||||
|
|
||||||
|
SendDeviceInterfaces(clientId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SendDeviceInterfaces(string clientId)
|
||||||
|
{
|
||||||
|
this.LogDebug("Sending Device interfaces");
|
||||||
|
var devices = DeviceManager.GetDevices();
|
||||||
|
Dictionary<string, DeviceInterfaceInfo> deviceInterfaces = new Dictionary<string, DeviceInterfaceInfo>();
|
||||||
|
|
||||||
|
foreach (var device in devices)
|
||||||
|
{
|
||||||
|
var interfaces = device?.GetType().GetInterfaces().Select((i) => i.Name).ToList() ?? new List<string>();
|
||||||
|
|
||||||
|
deviceInterfaces.Add(device.Key, new DeviceInterfaceInfo
|
||||||
|
{
|
||||||
|
Key = device.Key,
|
||||||
|
Name = (device as IKeyName)?.Name ?? "",
|
||||||
|
Interfaces = interfaces
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
var message = new MobileControlMessage
|
||||||
|
{
|
||||||
|
Type = "/system/deviceInterfaces",
|
||||||
|
ClientId = clientId,
|
||||||
|
Content = JToken.FromObject(new { deviceInterfaces })
|
||||||
|
};
|
||||||
|
|
||||||
|
SendMessageObject(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleUserCode(JToken content, Action<string, string> action = null)
|
private void HandleUserCode(JToken content, Action<string, string> action = null)
|
||||||
|
|||||||
Reference in New Issue
Block a user