[axis-camera-mpplugin] r178 committed - Moved the VAPIX command and parameters to a new class.

0 views
Skip to first unread message

axis-camer...@googlecode.com

unread,
Feb 13, 2011, 4:43:06 AM2/13/11
to axis-camer...@googlegroups.com
Revision: 178
Author: mattias.kindborg
Date: Sun Feb 13 01:42:37 2011
Log: Moved the VAPIX command and parameters to a new class.
http://code.google.com/p/axis-camera-mpplugin/source/detail?r=178

Added:
/trunk/Source/AxisCameraMPPlugin.Configuration/Service/Vapix.cs
Modified:

/trunk/Source/AxisCameraMPPlugin.Configuration/AxisCameraMPPlugin.Configuration.csproj

/trunk/Source/AxisCameraMPPlugin.Configuration/Service/CameraCommunicationService.cs

=======================================
--- /dev/null
+++ /trunk/Source/AxisCameraMPPlugin.Configuration/Service/Vapix.cs Sun Feb
13 01:42:37 2011
@@ -0,0 +1,52 @@
+#region Copyright (C) 2005-2010 Team MediaPortal
+
+// Copyright (C) 2005-2010 Team MediaPortal
+// http://www.team-mediaportal.com
+//
+// MediaPortal is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 2 of the License, or
+// (at your option) any later version.
+//
+// MediaPortal is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with MediaPortal. If not, see <http://www.gnu.org/licenses/>.
+
+#endregion
+
+namespace AxisCameraMPPlugin.Configuration.Service
+{
+ /// <summary>
+ /// Class describing the Axis VAPIX:
+ /// http://www.axis.com/techsup/cam_servers/dev/cam_http_api_index.php
+ /// </summary>
+ class Vapix
+ {
+ /// <summary>
+ /// Gets CGI for listing parameters.
+ /// </summary>
+ public const string ParameterCgi
= "http://{0}:{1}/axis-cgi/admin/param.cgi?action=list&group={2}";
+
+
+ /// <summary>
+ /// Gets CGI for requesting a snapshot.
+ /// </summary>
+ public const string SnapshotCgi
= "http://{0}:{1}/axis-cgi/jpg/image.cgi";
+
+
+ /// <summary>
+ /// Gets UPnP friendly name parameter name.
+ /// </summary>
+ public const string FriendlyName = "Network.UPnP.FriendlyName";
+
+
+ /// <summary>
+ /// Gets firmware version parameter name.
+ /// </summary>
+ public const string FirmwareVersion = "Properties.Firmware.Version";
+ }
+}
=======================================
---
/trunk/Source/AxisCameraMPPlugin.Configuration/AxisCameraMPPlugin.Configuration.csproj
Fri Jan 28 06:57:37 2011
+++
/trunk/Source/AxisCameraMPPlugin.Configuration/AxisCameraMPPlugin.Configuration.csproj
Sun Feb 13 01:42:37 2011
@@ -105,6 +105,7 @@
<DependentUpon>ParameterParser.cs</DependentUpon>
</Compile>
<Compile Include="Service\ParameterParser.cs" />
+ <Compile Include="Service\Vapix.cs" />
<Compile Include="ViewModel\CameraCommunicationDialogViewModel.cs" />
<Compile Include="ViewModel\CameraNameViewModel.cs" />
<Compile Include="ViewModel\Data\ConfigurableCamera.cs" />
=======================================
---
/trunk/Source/AxisCameraMPPlugin.Configuration/Service/CameraCommunicationService.cs
Fri Feb 11 06:54:23 2011
+++
/trunk/Source/AxisCameraMPPlugin.Configuration/Service/CameraCommunicationService.cs
Sun Feb 13 01:42:37 2011
@@ -29,14 +29,6 @@
/// </summary>
class CameraCommunicationService : ICameraCommunicationService,
IDisposable
{
- // CGIs
- private const string ParameterCgi
= "http://{0}:{1}/axis-cgi/admin/param.cgi?action=list&group={2}";
- private const string SnapshotCgi
= "http://{0}:{1}/axis-cgi/jpg/image.cgi";
-
- // Parameters
- private const string FriendlyName = "Network.UPnP.FriendlyName";
- private const string FirmwareVersion = "Properties.Firmware.Version";
-
private readonly IParameterParser parameterParser;

private ClientState<Parameters> parameterState;
@@ -88,10 +80,10 @@
parameterState.Client.Credentials = new NetworkCredential(
networkEndpoint.UserName,
networkEndpoint.Password);
- Uri parameterUri = new Uri(ParameterCgi.InvariantFormat(
+ Uri parameterUri = new Uri(Vapix.ParameterCgi.InvariantFormat(
networkEndpoint.Address,
networkEndpoint.Port,
- string.Join(",", new[] { FriendlyName, FirmwareVersion })));
+ string.Join(",", new[] { Vapix.FriendlyName, Vapix.FirmwareVersion
})));
parameterState.Client.DownloadStringAsync(parameterUri);

// Download snapshot
@@ -99,7 +91,7 @@
snapshotState.Client.Credentials = new NetworkCredential(
networkEndpoint.UserName,
networkEndpoint.Password);
- Uri snapshotUri = new Uri(SnapshotCgi.InvariantFormat(
+ Uri snapshotUri = new Uri(Vapix.SnapshotCgi.InvariantFormat(
networkEndpoint.Address,
networkEndpoint.Port));
snapshotState.Client.DownloadDataAsync(snapshotUri);
@@ -156,13 +148,13 @@
parameterState.Result = new Parameters();

IDictionary<string, string> parameters =
parameterParser.Parse(e.Result);
- if (parameters.ContainsKey(FriendlyName))
- {
- parameterState.Result.FriendlyName = parameters[FriendlyName];
- }
- if (parameters.ContainsKey(FirmwareVersion))
- {
- parameterState.Result.FirmwareVersion = parameters[FirmwareVersion];
+ if (parameters.ContainsKey(Vapix.FriendlyName))
+ {
+ parameterState.Result.FriendlyName = parameters[Vapix.FriendlyName];
+ }
+ if (parameters.ContainsKey(Vapix.FirmwareVersion))
+ {
+ parameterState.Result.FirmwareVersion =
parameters[Vapix.FirmwareVersion];
}
}

Reply all
Reply to author
Forward
0 new messages