Skip to content

Commit

Permalink
add recording flag and filtering to getobjectlist command for api
Browse files Browse the repository at this point in the history
  • Loading branch information
ispysoftware committed Oct 16, 2018
1 parent f267fbc commit 3c169a7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
4 changes: 2 additions & 2 deletions AssemblyInfo.cs
Expand Up @@ -25,7 +25,7 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:

[assembly: AssemblyVersion("7.1.5.0")]
[assembly: AssemblyVersion("7.1.6.0")]

//
// In order to sign your assembly you must specify a key to use. Refer to the
Expand Down Expand Up @@ -55,4 +55,4 @@
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]
[assembly: AssemblyFileVersion("7.1.5.0")]
[assembly: AssemblyFileVersion("7.1.6.0")]
18 changes: 12 additions & 6 deletions Server/LocalServer.cs
Expand Up @@ -2698,7 +2698,7 @@ private string DoCommand(string sRequest, int otid, string resp, string cmd, int
break;
case "getobjectlist":
//for 3rd party APIs
resp = GetObjectList();
resp = GetObjectList(otid,oid);
break;
case "getservername":
resp = MainForm.Conf.ServerName + ",OK";
Expand Down Expand Up @@ -3986,39 +3986,45 @@ public string FormatBytes(long bytes)
return "0 Bytes";
}

internal string GetObjectList()
internal string GetObjectList(int ot = 0, int oid =0)
{
string resp = "";
if (MainForm.Cameras != null)
if (MainForm.Cameras != null && (ot==0 || ot==2))
{
var l = MainForm.Cameras.OrderBy(p => p.name).ToList();
foreach (objectsCamera oc in l)
{
if (oid != 0 && oid != oc.id)
continue;
CameraWindow cw = MainForm.InstanceReference.GetCameraWindow(oc.id);
if (cw != null)
{
bool onlinestatus = cw.IsEnabled;
bool recording = cw.Recording;
bool talkconfigured = oc.settings.audiomodel != "None";
resp += "2," + oc.id + "," + onlinestatus.ToString().ToLower() + "," +
oc.name.Replace(",", ",") + "," + GetStatus(onlinestatus) + "," +
oc.description.Replace(",", ",").Replace("\n", " ") + "," +
oc.settings.accessgroups.Replace(",", ",").Replace("\n", " ") + "," + oc.ptz + "," + talkconfigured.ToString().ToLower() +"," + oc.settings.micpair + Environment.NewLine;
oc.settings.accessgroups.Replace(",", ",").Replace("\n", " ") + "," + oc.ptz + "," + talkconfigured.ToString().ToLower() +"," + oc.settings.micpair + ","+cw.Recording.ToString().ToLowerInvariant() + Environment.NewLine;
}
}
}
if (MainForm.Microphones != null)
if (MainForm.Microphones != null && (ot == 0 || ot == 1))
{
var l = MainForm.Microphones.OrderBy(p => p.name).ToList();
foreach (objectsMicrophone om in l)
{
if (oid != 0 && oid != om.id)
continue;
VolumeLevel vl = MainForm.InstanceReference.GetVolumeLevel(om.id);
if (vl!=null)
{
bool onlinestatus = vl.IsEnabled;
bool recording = vl.Recording;
resp += "1," + om.id + "," + onlinestatus.ToString().ToLower() + "," +
om.name.Replace(",", ",") + "," + GetStatus(onlinestatus) + "," +
om.description.Replace(",", ",").Replace("\n", " ") + "," +
om.settings.accessgroups.Replace(",", ",").Replace("\n", " ") + Environment.NewLine;
om.settings.accessgroups.Replace(",", ",").Replace("\n", " ") + ","+recording.ToString().ToLowerInvariant()+Environment.NewLine;
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions Wix/Bootstrap64/Bootstrap64.wixproj
Expand Up @@ -54,6 +54,9 @@
call "D:\Projects\iSpy\signing\Wix_iSpyBurn64.bat"
:end</PostBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PreBuildEvent>ee</PreBuildEvent>
</PropertyGroup>
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Wix.targets.
Expand Down

0 comments on commit 3c169a7

Please sign in to comment.