xiongzhu vor 5 Jahren
Ursprung
Commit
a5cae362e5
1 geänderte Dateien mit 38 neuen und 0 gelöschten Zeilen
  1. 38 0
      views/MainWindow.xaml.cs

+ 38 - 0
views/MainWindow.xaml.cs

@@ -359,5 +359,43 @@ namespace DeviceCenter
             }
             return;
         }
+
+        public void getDepartments()
+        {
+            int m_userId = -1;
+            AcsDevice device = null;
+            try
+            {
+                device = (AcsDevice)devices.First(i => i.type == DeviceType.ACS && i.status == DeviceStatus.CONNECTED);
+            }
+            catch { }
+            if (device == null)
+            {
+                log.Info("no connected device");
+                return;
+            }
+            IntPtr lpRequestUrl = IntPtr.Zero;
+            try
+            {
+                CHCNetSDK.NET_DVR_XML_CONFIG_INPUT input = new CHCNetSDK.NET_DVR_XML_CONFIG_INPUT();
+                CHCNetSDK.NET_DVR_XML_CONFIG_INPUT output = new CHCNetSDK.NET_DVR_XML_CONFIG_INPUT();
+                string url = "/ISAPI/AccessControl/DepartmentParam/capabilities";
+                lpRequestUrl = Marshal.StringToHGlobalAnsi(url);
+                input.lpRequestUrl = lpRequestUrl;
+                IntPtr inputPtr = new IntPtr();
+                IntPtr outputPtr = new IntPtr();
+                Marshal.StructureToPtr(input, inputPtr, true);
+                CHCNetSDK.NET_DVR_STDXMLConfig(m_userId, inputPtr, outputPtr);
+            }
+            catch (Exception e) { }
+            finally
+            {
+                if (lpRequestUrl != IntPtr.Zero)
+                {
+                    Marshal.FreeHGlobal(lpRequestUrl);
+                }
+
+            }
+        }
     }
 }