subiendo todo el proyecto
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src">
|
||||
<attributes>
|
||||
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="JavaDemo/libs/linux32"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="examples.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="lib" path="jna.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>JavaDemo</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
@@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
|
||||
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- You may freely edit this file. See commented blocks below for -->
|
||||
<!-- some examples of how to customize the build. -->
|
||||
<!-- (If you delete it and reopen the project it will be recreated.) -->
|
||||
<!-- By default, only the Clean and Build commands use this build script. -->
|
||||
<!-- Commands such as Run, Debug, and Test only use this build script if -->
|
||||
<!-- the Compile on Save feature is turned off for the project. -->
|
||||
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
|
||||
<!-- in the project's Project Properties dialog box.-->
|
||||
<project name="ClientDemo" default="default" basedir=".">
|
||||
<description>Builds, tests, and runs the project ClientDemo.</description>
|
||||
<import file="nbproject/build-impl.xml"/>
|
||||
<!--
|
||||
|
||||
There exist several targets which are by default empty and which can be
|
||||
used for execution of your tasks. These targets are usually executed
|
||||
before and after some main targets. They are:
|
||||
|
||||
-pre-init: called before initialization of project properties
|
||||
-post-init: called after initialization of project properties
|
||||
-pre-compile: called before javac compilation
|
||||
-post-compile: called after javac compilation
|
||||
-pre-compile-single: called before javac compilation of single file
|
||||
-post-compile-single: called after javac compilation of single file
|
||||
-pre-compile-test: called before javac compilation of JUnit tests
|
||||
-post-compile-test: called after javac compilation of JUnit tests
|
||||
-pre-compile-test-single: called before javac compilation of single JUnit test
|
||||
-post-compile-test-single: called after javac compilation of single JUunit test
|
||||
-pre-jar: called before JAR building
|
||||
-post-jar: called after JAR building
|
||||
-post-clean: called after cleaning build products
|
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.)
|
||||
|
||||
Example of inserting an obfuscator after compilation could look like this:
|
||||
|
||||
<target name="-post-compile">
|
||||
<obfuscate>
|
||||
<fileset dir="${build.classes.dir}"/>
|
||||
</obfuscate>
|
||||
</target>
|
||||
|
||||
For list of available properties check the imported
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
|
||||
Another way to customize the build is by overriding existing main targets.
|
||||
The targets of interest are:
|
||||
|
||||
-init-macrodef-javac: defines macro for javac compilation
|
||||
-init-macrodef-junit: defines macro for junit execution
|
||||
-init-macrodef-debug: defines macro for class debugging
|
||||
-init-macrodef-java: defines macro for class execution
|
||||
-do-jar-with-manifest: JAR building (if you are using a manifest)
|
||||
-do-jar-without-manifest: JAR building (if you are not using a manifest)
|
||||
run: execution of project
|
||||
-javadoc-build: Javadoc generation
|
||||
test-report: JUnit report generation
|
||||
|
||||
An example of overriding the target for project execution could look like this:
|
||||
|
||||
<target name="run" depends="ClientDemo-impl.jar">
|
||||
<exec dir="bin" executable="launcher.exe">
|
||||
<arg file="${dist.jar}"/>
|
||||
</exec>
|
||||
</target>
|
||||
|
||||
Notice that the overridden target depends on the jar target and not only on
|
||||
the compile target as the regular run target does. Again, for a list of available
|
||||
properties which you can use, check the target you are overriding in the
|
||||
nbproject/build-impl.xml file.
|
||||
|
||||
-->
|
||||
</project>
|
||||
@@ -0,0 +1,7 @@
|
||||
Demo compiling environment: Eclipse, JDK1.8
|
||||
|
||||
method one<6E><65>
|
||||
add netsdk lib to /usr/lib, then copy the lib in HCNetSDKCom to the file directory /usr/lib
|
||||
|
||||
method two:
|
||||
Modify ld.so.conf file in the directory /etc. Add the path to the so file you need for your Java project. Then call the ldconfig command to enable the configuration to take effect
|
||||
@@ -0,0 +1,544 @@
|
||||
package test;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Queue;
|
||||
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
import com.sun.jna.NativeLong;
|
||||
import com.sun.jna.Pointer;
|
||||
|
||||
import test.HCNetSDK.NET_DVR_PDC_ALRAM_INFO;
|
||||
import test.HCNetSDK.NET_DVR_PLATE_RESULT;
|
||||
import test.HCNetSDK.struAlarmChannel;
|
||||
import test.HCNetSDK.struAlarmHardDisk;
|
||||
import test.HCNetSDK.struIOAlarm;
|
||||
import test.HCNetSDK.struStartTime;
|
||||
import test.HCNetSDK.struStatFrame;
|
||||
|
||||
public class AlarmThread extends Thread {
|
||||
|
||||
private AlarmThread() {
|
||||
|
||||
}
|
||||
|
||||
private static AlarmThread m_alarmThread = null;
|
||||
private static boolean m_bStart;
|
||||
private static Queue<QueueMessage> m_queueMessage;
|
||||
|
||||
private HCNetSDK.RECV_ALARM m_palarmInfo;
|
||||
private NativeLong m_command;
|
||||
private HCNetSDK.NET_DVR_ALARMER m_pAlarmer;
|
||||
|
||||
|
||||
/**
|
||||
* @param palarmInfo
|
||||
* @param command
|
||||
* @param pAlarmer
|
||||
*/
|
||||
public AlarmThread(HCNetSDK.RECV_ALARM palarmInfo,NativeLong command,HCNetSDK.NET_DVR_ALARMER pAlarmer)
|
||||
{
|
||||
m_palarmInfo = palarmInfo;
|
||||
m_command = command;
|
||||
m_pAlarmer = pAlarmer;
|
||||
m_bStart = false;
|
||||
}
|
||||
|
||||
public void SetStart(boolean bStart)
|
||||
{
|
||||
m_bStart = bStart;
|
||||
}
|
||||
public boolean GetStart()
|
||||
{
|
||||
return m_bStart;
|
||||
}
|
||||
|
||||
public static AlarmThread getInstance() {
|
||||
if (m_alarmThread == null) {
|
||||
m_alarmThread = new AlarmThread();
|
||||
m_queueMessage = new LinkedList<QueueMessage>();
|
||||
}
|
||||
return m_alarmThread;
|
||||
}
|
||||
|
||||
public void AddMessage(QueueMessage queueMessage) {
|
||||
synchronized (this){System.out.println("add message");
|
||||
m_queueMessage.add(queueMessage);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QueueMessage RemoveMessage() {
|
||||
synchronized (this)
|
||||
{
|
||||
System.out.println("remove message");
|
||||
return m_queueMessage.remove();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void run() {
|
||||
while(true){
|
||||
try
|
||||
{
|
||||
Thread.sleep(5);
|
||||
} catch (InterruptedException e)
|
||||
{
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
//System.out.println(m_queueMessage.isEmpty());
|
||||
|
||||
if(!m_queueMessage.isEmpty()) {
|
||||
System.out.println(m_queueMessage.isEmpty());
|
||||
QueueMessage queueMessage = RemoveMessage();
|
||||
NativeLong command = queueMessage.getM_command();
|
||||
HCNetSDK.RECV_ALARM palarmInfo = queueMessage.getM_palarmInfo();
|
||||
HCNetSDK.NET_DVR_ALARMER pAlarmer = queueMessage.getM_pAlarmer();
|
||||
//NativeLong command = m_command;
|
||||
//HCNetSDK.RECV_ALARM palarmInfo = m_palarmInfo;
|
||||
//HCNetSDK.NET_DVR_ALARMER pAlarmer = m_pAlarmer;
|
||||
//System.out.println("------------2");
|
||||
switch (command.intValue()) {
|
||||
|
||||
|
||||
case HCNetSDK.COMM_ALARM_V40:
|
||||
HCNetSDK.NET_DVR_ALARMINFO_V40 struAlarmInfoV40 = new HCNetSDK.NET_DVR_ALARMINFO_V40();
|
||||
struAlarmInfoV40.write();
|
||||
Pointer pInfoV40 = struAlarmInfoV40.getPointer();
|
||||
pInfoV40.write(0, palarmInfo.RecvBuffer, 0, struAlarmInfoV40.size());
|
||||
struAlarmInfoV40.read();
|
||||
HandleAlarmV40(struAlarmInfoV40, pAlarmer);
|
||||
break;
|
||||
case HCNetSDK.COMM_ALARM_V30:
|
||||
HCNetSDK.NET_DVR_ALARMINFO_V30 strAlarmInfoV30 = new HCNetSDK.NET_DVR_ALARMINFO_V30();
|
||||
strAlarmInfoV30.write();
|
||||
Pointer pInfoV30 = strAlarmInfoV30.getPointer();
|
||||
pInfoV30.write(0, palarmInfo.RecvBuffer, 0, strAlarmInfoV30.size());
|
||||
strAlarmInfoV30.read();
|
||||
HandleAlarmV30(strAlarmInfoV30, pAlarmer);
|
||||
break;
|
||||
case HCNetSDK.COMM_ALARM:
|
||||
HCNetSDK.NET_DVR_ALARMINFO strAlarmInfo = new HCNetSDK.NET_DVR_ALARMINFO();
|
||||
strAlarmInfo.write();
|
||||
Pointer pInfo = strAlarmInfo.getPointer();
|
||||
pInfo.write(0, palarmInfo.RecvBuffer, 0, strAlarmInfo.size());
|
||||
strAlarmInfo.read();
|
||||
HandleAlarm(strAlarmInfo, pAlarmer);
|
||||
break;
|
||||
|
||||
// Traffic statistics
|
||||
case HCNetSDK.COMM_ALARM_PDC:
|
||||
NET_DVR_PDC_ALRAM_INFO struPdcInfo = new NET_DVR_PDC_ALRAM_INFO();
|
||||
struPdcInfo.write();
|
||||
Pointer pPdcInfo = struPdcInfo.getPointer();
|
||||
pPdcInfo.write(0, palarmInfo.RecvBuffer, 0, struPdcInfo.size());
|
||||
struPdcInfo.read();
|
||||
HandleAlarmPDC(struPdcInfo, pAlarmer);
|
||||
break;
|
||||
|
||||
// License plate recognition
|
||||
case HCNetSDK.COMM_UPLOAD_PLATE_RESULT:
|
||||
NET_DVR_PLATE_RESULT struResult = new NET_DVR_PLATE_RESULT();
|
||||
struResult.write();
|
||||
Pointer pResult = struResult.getPointer();
|
||||
pResult.write(0, palarmInfo.RecvBuffer, 0, struResult.size());
|
||||
struResult.read();
|
||||
HandlePlateResult(struResult, pAlarmer);
|
||||
break;
|
||||
|
||||
default:
|
||||
//log.info("unknow type");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void HandleAlarmV40(HCNetSDK.NET_DVR_ALARMINFO_V40 struAlarmInfo, HCNetSDK.NET_DVR_ALARMER pAlarmer) {
|
||||
boolean bDisk = false;
|
||||
boolean bAlarmOut = false;
|
||||
String sAlarmType = "";
|
||||
String sAlarmInfo = "";
|
||||
int iLen = 0;
|
||||
int arr[] = new int[iLen];
|
||||
int dwOffSetLen = 0;
|
||||
arr = struAlarmInfo.pAlarmData.getIntArray(0, iLen);
|
||||
switch (struAlarmInfo.struAlarmFixedHeader.dwAlarmType) {
|
||||
case 0:
|
||||
struAlarmInfo.struAlarmFixedHeader.ustruAlarm.setType(struIOAlarm.class);
|
||||
sAlarmInfo = "Switch alarm inpu No."
|
||||
+ (struAlarmInfo.struAlarmFixedHeader.ustruAlarm.struioAlarm.dwAlarmInputNo + 1);
|
||||
sAlarmType = "Invoke Alarm Out:";
|
||||
iLen += struAlarmInfo.struAlarmFixedHeader.ustruAlarm.struioAlarm.dwTrigerAlarmOutNum;
|
||||
for (int i = 0; i < struAlarmInfo.struAlarmFixedHeader.ustruAlarm.struioAlarm.dwTrigerAlarmOutNum; i++) {
|
||||
if (arr[i] != 0xffffffff) {
|
||||
sAlarmInfo += sAlarmType + " " + arr[i];
|
||||
}
|
||||
}
|
||||
sAlarmInfo += "Invoke record Channel:";
|
||||
dwOffSetLen += struAlarmInfo.struAlarmFixedHeader.ustruAlarm.struioAlarm.dwTrigerAlarmOutNum;
|
||||
for (int i = 0; i < struAlarmInfo.struAlarmFixedHeader.ustruAlarm.struioAlarm.dwTrigerRecordChanNum; i++) {
|
||||
if (arr[i + dwOffSetLen] != 0xffffffff) {
|
||||
sAlarmInfo += " " + arr[i + dwOffSetLen];
|
||||
dwOffSetLen++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
struAlarmInfo.struAlarmFixedHeader.ustruAlarm.setType(struAlarmHardDisk.class);
|
||||
sAlarmInfo = "HD is full:";
|
||||
for (int i = 0; i < struAlarmInfo.struAlarmFixedHeader.ustruAlarm.strualarmHardDisk.dwAlarmHardDiskNum; i++) {
|
||||
if (arr[i + dwOffSetLen] != 0xffffffff) {
|
||||
sAlarmInfo += " " + arr[i + dwOffSetLen];
|
||||
dwOffSetLen++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
struAlarmInfo.struAlarmFixedHeader.ustruAlarm.setType(struAlarmHardDisk.class);
|
||||
sAlarmInfo = "not formatted";
|
||||
for (int i = 0; i < struAlarmInfo.struAlarmFixedHeader.ustruAlarm.strualarmHardDisk.dwAlarmHardDiskNum; i++) {
|
||||
int iTemp = arr[i + dwOffSetLen];
|
||||
if (iTemp > 0) {
|
||||
sAlarmInfo += " HDD " + iTemp;
|
||||
dwOffSetLen++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
struAlarmInfo.struAlarmFixedHeader.ustruAlarm.setType(struAlarmHardDisk.class);
|
||||
for (int i = 0; i < struAlarmInfo.struAlarmFixedHeader.ustruAlarm.strualarmHardDisk.dwAlarmHardDiskNum; i++) {
|
||||
int iTemp = arr[i + dwOffSetLen];
|
||||
if (iTemp > 0) {
|
||||
bDisk = true;
|
||||
sAlarmInfo += "failed to read and write HDD HDD" + iTemp;
|
||||
dwOffSetLen++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bDisk == false) {
|
||||
sAlarmInfo = "No HDD";
|
||||
}
|
||||
bDisk = false;
|
||||
break;
|
||||
case 2:
|
||||
struAlarmInfo.struAlarmFixedHeader.ustruAlarm.setType(struAlarmChannel.class);
|
||||
bAlarmOut = true;
|
||||
sAlarmInfo = "The signal lost";
|
||||
break;
|
||||
case 3:
|
||||
struAlarmInfo.struAlarmFixedHeader.ustruAlarm.setType(struAlarmChannel.class);
|
||||
bAlarmOut = true;
|
||||
sAlarmInfo = "motion detection";
|
||||
break;
|
||||
case 6:
|
||||
struAlarmInfo.struAlarmFixedHeader.ustruAlarm.setType(struAlarmChannel.class);
|
||||
bAlarmOut = true;
|
||||
sAlarmInfo = "Mask alarm";
|
||||
break;
|
||||
case 9:
|
||||
struAlarmInfo.struAlarmFixedHeader.ustruAlarm.setType(struAlarmChannel.class);
|
||||
bAlarmOut = true;
|
||||
sAlarmInfo = "video exception";
|
||||
break;
|
||||
case 10:
|
||||
struAlarmInfo.struAlarmFixedHeader.ustruAlarm.setType(struAlarmChannel.class);
|
||||
bAlarmOut = true;
|
||||
sAlarmInfo = "record exception";
|
||||
break;
|
||||
case 11:
|
||||
struAlarmInfo.struAlarmFixedHeader.ustruAlarm.setType(struAlarmChannel.class);
|
||||
bAlarmOut = true;
|
||||
sAlarmInfo = "Vca scene change";
|
||||
break;
|
||||
case 13:
|
||||
struAlarmInfo.struAlarmFixedHeader.ustruAlarm.setType(struAlarmChannel.class);
|
||||
bAlarmOut = true;
|
||||
sAlarmInfo = "resolution mismatch";
|
||||
break;
|
||||
case 15:
|
||||
struAlarmInfo.struAlarmFixedHeader.ustruAlarm.setType(struAlarmChannel.class);
|
||||
bAlarmOut = true;
|
||||
sAlarmInfo = "VCA Detection";
|
||||
break;
|
||||
case 16:
|
||||
struAlarmInfo.struAlarmFixedHeader.ustruAlarm.setType(struAlarmChannel.class);
|
||||
bAlarmOut = true;
|
||||
sAlarmInfo = "host record alarm";
|
||||
break;
|
||||
|
||||
case 7: // type unmatched
|
||||
sAlarmInfo = "input and output video standard not match";
|
||||
break;
|
||||
case 8:
|
||||
sAlarmInfo = "illegal access";
|
||||
break;
|
||||
case 12:
|
||||
sAlarmInfo = "Array exception";
|
||||
break;
|
||||
case 14:
|
||||
sAlarmInfo = "Alloc decoede resource fail";
|
||||
break;
|
||||
case 17:
|
||||
sAlarmInfo = "hot spare alarm";
|
||||
break;
|
||||
default:
|
||||
sAlarmInfo = "Unknow";
|
||||
break;
|
||||
}
|
||||
|
||||
AddAlarmInfo(sAlarmInfo, pAlarmer);
|
||||
}
|
||||
|
||||
public void HandleAlarmV30(HCNetSDK.NET_DVR_ALARMINFO_V30 struAlarmInfo, HCNetSDK.NET_DVR_ALARMER pAlarmer) {
|
||||
boolean bDisk = false;
|
||||
String sAlarmInfo = "";
|
||||
switch (struAlarmInfo.dwAlarmType) {
|
||||
case 0:
|
||||
sAlarmInfo = "Switch alarm input" + (struAlarmInfo.dwAlarmInputNumber + 1);
|
||||
sAlarmInfo += "Invoke record Channel:";
|
||||
for (int i = 0; i < HCNetSDK.MAX_CHANNUM_V30; i++) {
|
||||
if (struAlarmInfo.byAlarmRelateChannel[i] == 1) {
|
||||
sAlarmInfo += "" + i;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
sAlarmInfo = "HD is full:";
|
||||
for (int i = 0; i < HCNetSDK.MAX_DISKNUM_V30; i++) {
|
||||
if (struAlarmInfo.byDiskNumber[i] == 1) {
|
||||
sAlarmInfo += " HDD " + (i + 1);
|
||||
}
|
||||
}
|
||||
case 2:
|
||||
sAlarmInfo = "The signal lost";
|
||||
break;
|
||||
case 3:
|
||||
sAlarmInfo = "motion detection";
|
||||
break;
|
||||
case 4:
|
||||
sAlarmInfo = "not formatted";
|
||||
for (int i = 0; i < HCNetSDK.MAX_DISKNUM_V30; i++) {
|
||||
if (struAlarmInfo.byDiskNumber[i] == 1) {
|
||||
sAlarmInfo += " HDD" + i;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
for (int i = 0; i < HCNetSDK.MAX_DISKNUM_V30; i++) {
|
||||
if (struAlarmInfo.byDiskNumber[i] == 1) {
|
||||
bDisk = true;
|
||||
sAlarmInfo = "failed to read and write HDD" + (i + 1);
|
||||
AddAlarmInfo(sAlarmInfo, pAlarmer);
|
||||
}
|
||||
}
|
||||
if (bDisk == false) {
|
||||
sAlarmInfo = "No HDD";
|
||||
}
|
||||
bDisk = false;
|
||||
break;
|
||||
case 6:
|
||||
sAlarmInfo = "Mask alarm";
|
||||
break;
|
||||
case 7:
|
||||
sAlarmInfo = "input and output video standard not match";
|
||||
break;
|
||||
case 8:
|
||||
sAlarmInfo = "illegal access";
|
||||
break;
|
||||
case 9:
|
||||
sAlarmInfo = "video exception";
|
||||
break;
|
||||
case 10:
|
||||
sAlarmInfo = "record exception";
|
||||
break;
|
||||
case 11:
|
||||
sAlarmInfo = "Vca scene change";
|
||||
break;
|
||||
case 12:
|
||||
sAlarmInfo = "Array exception";
|
||||
break;
|
||||
case 13:
|
||||
sAlarmInfo = "resolution mismatch ";
|
||||
break;
|
||||
case 14:
|
||||
sAlarmInfo = "Alloc decoede resource fail";
|
||||
break;
|
||||
case 15:
|
||||
sAlarmInfo = "VCA Detction";
|
||||
break;
|
||||
case 16:
|
||||
sAlarmInfo = "POE Power Exception";
|
||||
break;
|
||||
case 17:
|
||||
sAlarmInfo = "Flash anomaly";
|
||||
break;
|
||||
case 18:
|
||||
sAlarmInfo = "Disk full load anomaly";
|
||||
break;
|
||||
case 19:
|
||||
sAlarmInfo = "The audio signal lost";
|
||||
break;
|
||||
default:
|
||||
sAlarmInfo = "Unknown Alarm Type:" + struAlarmInfo.dwAlarmType;
|
||||
break;
|
||||
}
|
||||
AddAlarmInfo(sAlarmInfo, pAlarmer);
|
||||
|
||||
}
|
||||
|
||||
public void HandleAlarm(HCNetSDK.NET_DVR_ALARMINFO strAlarmInfo, HCNetSDK.NET_DVR_ALARMER pAlarmer) {
|
||||
String sAlarmType = "";
|
||||
boolean bDisk = false;
|
||||
switch (strAlarmInfo.dwAlarmType) {
|
||||
case 0:
|
||||
sAlarmType = "Switch alarm input";
|
||||
break;
|
||||
case 1:
|
||||
sAlarmType = "HDD is Full:";
|
||||
for (int i = 0; i < HCNetSDK.MAX_DISKNUM; i++) {
|
||||
if (strAlarmInfo.dwDiskNumber[i] == 1) {
|
||||
sAlarmType += " HDD" + i;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
sAlarmType = "The video signal lost";
|
||||
break;
|
||||
case 3:
|
||||
sAlarmType = "motion detection";
|
||||
break;
|
||||
case 4:
|
||||
sAlarmType = "HDD not formatted:";
|
||||
for (int i = 0; i < HCNetSDK.MAX_DISKNUM; i++) {
|
||||
if (strAlarmInfo.dwDiskNumber[i] == 1) {
|
||||
sAlarmType += " HDD" + i;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
for (int i = 0; i < HCNetSDK.MAX_DISKNUM; i++) {
|
||||
if (strAlarmInfo.dwDiskNumber[i] == 1) {
|
||||
bDisk = true;
|
||||
sAlarmType = "failed to read and write HDD HDD" + i;
|
||||
AddAlarmInfo(sAlarmType, pAlarmer);
|
||||
}
|
||||
}
|
||||
if (bDisk == false) {
|
||||
sAlarmType = "no HDD";
|
||||
}
|
||||
bDisk = false;
|
||||
break;
|
||||
case 6:
|
||||
sAlarmType = "Mask alarm";
|
||||
break;
|
||||
case 7:
|
||||
sAlarmType = "input and output video standard not match";
|
||||
break;
|
||||
case 8:
|
||||
sAlarmType = "illegal access";
|
||||
break;
|
||||
case 9:
|
||||
sAlarmType = "video exception";
|
||||
break;
|
||||
case 10:
|
||||
sAlarmType = "record exception";
|
||||
break;
|
||||
case 11:
|
||||
sAlarmType = "Vca scene change";
|
||||
break;
|
||||
default:
|
||||
sAlarmType = "Unknown Alarm Type";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void HandleAlarmPDC(HCNetSDK.NET_DVR_PDC_ALRAM_INFO struAlarmInfo, HCNetSDK.NET_DVR_ALARMER pAlarmer) {
|
||||
String sAlarmInfo = "";
|
||||
if (struAlarmInfo.byMode == 0) {
|
||||
struAlarmInfo.ustateModeParam.setType(struStatFrame.class);
|
||||
HCNetSDK.NET_DVR_TIME struAbsTime = new HCNetSDK.NET_DVR_TIME();
|
||||
struAbsTime.dwYear = struAlarmInfo.ustateModeParam.strustatFrame.dwAbsTime >> 26 + 2000;
|
||||
struAbsTime.dwMonth = struAlarmInfo.ustateModeParam.strustatFrame.dwAbsTime >> 22 & 15;
|
||||
struAbsTime.dwDay = struAlarmInfo.ustateModeParam.strustatFrame.dwAbsTime >> 17 & 31;
|
||||
struAbsTime.dwHour = struAlarmInfo.ustateModeParam.strustatFrame.dwAbsTime >> 12 & 31;
|
||||
struAbsTime.dwMinute = struAlarmInfo.ustateModeParam.strustatFrame.dwAbsTime >> 6 & 63;
|
||||
struAbsTime.dwSecond = struAlarmInfo.ustateModeParam.strustatFrame.dwAbsTime >> 0 & 63;
|
||||
|
||||
HCNetSDK.NET_DVR_TIME struRelativeTime = new HCNetSDK.NET_DVR_TIME();
|
||||
struRelativeTime.dwYear = struAlarmInfo.ustateModeParam.strustatFrame.dwRelativeTime >> 26 + 2000;
|
||||
struRelativeTime.dwMonth = struAlarmInfo.ustateModeParam.strustatFrame.dwRelativeTime >> 22 & 15;
|
||||
struRelativeTime.dwDay = struAlarmInfo.ustateModeParam.strustatFrame.dwRelativeTime >> 17 & 31;
|
||||
struRelativeTime.dwHour = struAlarmInfo.ustateModeParam.strustatFrame.dwRelativeTime >> 12 & 31;
|
||||
struRelativeTime.dwMinute = struAlarmInfo.ustateModeParam.strustatFrame.dwRelativeTime >> 6 & 63;
|
||||
struRelativeTime.dwSecond = struAlarmInfo.ustateModeParam.strustatFrame.dwRelativeTime >> 0 & 63;
|
||||
|
||||
sAlarmInfo.format(
|
||||
"Abs[%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d] Rel[%4.4d%2.2d%2.2d%2.2d%2.2d%2.2d] DevIP:[%s]Port[%d]Channel[%d]"
|
||||
+ "single frame:Channel[%d]LeaveNum[%d]EnterNum[%d]Smart[%d]",
|
||||
struAbsTime.dwYear, struAbsTime.dwMonth, struAbsTime.dwDay, struAbsTime.dwHour,
|
||||
struAbsTime.dwMinute, struAbsTime.dwSecond, struRelativeTime.dwYear, struRelativeTime.dwMonth,
|
||||
struRelativeTime.dwDay, struRelativeTime.dwHour, struRelativeTime.dwMinute,
|
||||
struRelativeTime.dwSecond, struAlarmInfo.struDevInfo.struDevIP.sIpV4,
|
||||
struAlarmInfo.struDevInfo.wPort, struAlarmInfo.struDevInfo.byChannel, struAlarmInfo.byChannel,
|
||||
struAlarmInfo.dwLeaveNum, struAlarmInfo.dwEnterNum, struAlarmInfo.bySmart);
|
||||
} else if (struAlarmInfo.byMode == 1) {
|
||||
struAlarmInfo.ustateModeParam.setType(struStartTime.class);
|
||||
sAlarmInfo.format(
|
||||
"DevIP:[%s]Port[%d]Channel[%d]:time range:Start Y[%d]M[%d]D[%d]H[%d]M[%d]S[%d] End Y[%d]M[%d]D[%d]H[%d]M[%d]S[%d]Channel[%d]LeaveNum[%d]EnterNum[%d]Smart[%d]",
|
||||
struAlarmInfo.struDevInfo.struDevIP.sIpV4, struAlarmInfo.struDevInfo.wPort,
|
||||
struAlarmInfo.struDevInfo.byChannel, struAlarmInfo.ustateModeParam.strustartTime.tmStart.dwYear,
|
||||
struAlarmInfo.ustateModeParam.strustartTime.tmStart.dwMonth,
|
||||
struAlarmInfo.ustateModeParam.strustartTime.tmStart.dwDay,
|
||||
struAlarmInfo.ustateModeParam.strustartTime.tmStart.dwHour,
|
||||
struAlarmInfo.ustateModeParam.strustartTime.tmStart.dwMinute,
|
||||
struAlarmInfo.ustateModeParam.strustartTime.tmStart.dwSecond,
|
||||
|
||||
struAlarmInfo.ustateModeParam.strustartTime.tmEnd.dwYear,
|
||||
struAlarmInfo.ustateModeParam.strustartTime.tmEnd.dwMonth,
|
||||
struAlarmInfo.ustateModeParam.strustartTime.tmEnd.dwDay,
|
||||
struAlarmInfo.ustateModeParam.strustartTime.tmEnd.dwHour,
|
||||
struAlarmInfo.ustateModeParam.strustartTime.tmEnd.dwMinute,
|
||||
struAlarmInfo.ustateModeParam.strustartTime.tmEnd.dwSecond,
|
||||
|
||||
struAlarmInfo.byChannel, struAlarmInfo.dwLeaveNum, struAlarmInfo.dwEnterNum, struAlarmInfo.bySmart);
|
||||
}
|
||||
|
||||
AddAlarmInfo(sAlarmInfo, pAlarmer);
|
||||
}
|
||||
|
||||
public void HandlePlateResult(HCNetSDK.NET_DVR_PLATE_RESULT struAlarmInfo, HCNetSDK.NET_DVR_ALARMER pAlarmer) {
|
||||
String sAlarmInfo = "";
|
||||
sAlarmInfo += "byResult[" + struAlarmInfo.byResultType + "]byChanIndex[" + struAlarmInfo.byChanIndex
|
||||
+ "]wAlarmRecordID[" + struAlarmInfo.wAlarmRecordID + "]dwRelativeTime[" + struAlarmInfo.dwRelativeTime
|
||||
+ "]dwPicLen[" + struAlarmInfo.dwPicLen + "]dwPicPlateLen[" + struAlarmInfo.dwPicPlateLen
|
||||
+ "]dwVideoLen[" + struAlarmInfo.dwVideoLen + "]byTrafficLight[" + struAlarmInfo.byTrafficLight
|
||||
+ "]byPicNum[" + struAlarmInfo.byPicNum + "]byDvriveChan[" + struAlarmInfo.byDriveChan
|
||||
+ "]byVehicleType[" + struAlarmInfo.byVehicleType + "]dwBinPicLen[" + struAlarmInfo.dwBinPicLen;
|
||||
AddAlarmInfo(sAlarmInfo, pAlarmer);
|
||||
}
|
||||
|
||||
public void AddAlarmInfo(String strInfo, HCNetSDK.NET_DVR_ALARMER pAlarmer) {
|
||||
DefaultTableModel alarmTableModel = JavaDemo.getTableModel();
|
||||
String[] newRow = new String[3];
|
||||
// alarm time
|
||||
Date today = new Date();
|
||||
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||
String[] sIP = new String[2];
|
||||
newRow[0] = dateFormat.format(today);
|
||||
//alarm info
|
||||
newRow[1] = strInfo;
|
||||
// device ip
|
||||
sIP = new String(pAlarmer.sDeviceIP).split("\0", 2);
|
||||
newRow[2] = sIP[0];
|
||||
alarmTableModel.insertRow(0, newRow);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package test;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JSlider;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import com.sun.jna.NativeLong;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.JButton;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
|
||||
public class AudioCfg extends JDialog {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
static HCNetSDK hCNetSDK = HCNetSDK.INSTANCE;
|
||||
private NativeLong m_lUserID;
|
||||
private int m_iChanNum;
|
||||
|
||||
private HCNetSDK.NET_DVR_AUDIO_INPUT_PARAM m_struAduioInputParam = new HCNetSDK.NET_DVR_AUDIO_INPUT_PARAM();
|
||||
|
||||
private JComboBox<String> m_cmbAudioEncode;
|
||||
private String[] m_sAudioEncode = {"G.722.1", "G.711ulaw", "G.711alaw", "MP2L2", "G.726", "AAC", "PCM"};
|
||||
private JComboBox<String> m_cmbAudioInput;
|
||||
private String[] m_sAudioInput = {"MicIn", "LineIn"};
|
||||
private JSlider m_sliderVolume;
|
||||
private JTextField m_textFieldInputVolume;
|
||||
private JComboBox<String> m_cmbNoiseFilter;
|
||||
private String[] m_sNoiseFilter = {"Close", "Open"};
|
||||
|
||||
/**
|
||||
* Create the panel.
|
||||
*/
|
||||
public AudioCfg(NativeLong lUserID, int iChanNum) {
|
||||
setTitle("Audio Configure");
|
||||
getContentPane().setLayout(null);
|
||||
m_lUserID = lUserID;
|
||||
m_iChanNum = iChanNum;
|
||||
|
||||
JLabel lblAudioEncode = new JLabel("Audio Encode");
|
||||
lblAudioEncode.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblAudioEncode.setBounds(62, 24, 131, 15);
|
||||
getContentPane().add(lblAudioEncode);
|
||||
|
||||
JLabel lblAudioInput = new JLabel("Audio Input");
|
||||
lblAudioInput.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblAudioInput.setBounds(62, 54, 131, 15);
|
||||
getContentPane().add(lblAudioInput);
|
||||
|
||||
JLabel lblInputVolume = new JLabel("Input Volume");
|
||||
lblInputVolume.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblInputVolume.setBounds(62, 84, 131, 15);
|
||||
getContentPane().add(lblInputVolume);
|
||||
|
||||
JLabel lblNoiseFilter = new JLabel("Noise Filter");
|
||||
lblNoiseFilter.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblNoiseFilter.setBounds(62, 114, 131, 15);
|
||||
getContentPane().add(lblNoiseFilter);
|
||||
|
||||
m_cmbAudioEncode = new JComboBox<String>();
|
||||
m_cmbAudioEncode.setModel(new DefaultComboBoxModel<String>(m_sAudioEncode));
|
||||
m_cmbAudioEncode.setBounds(240, 21, 177, 21);
|
||||
getContentPane().add(m_cmbAudioEncode);
|
||||
|
||||
m_cmbAudioInput = new JComboBox<String>();
|
||||
m_cmbAudioInput.setModel(new DefaultComboBoxModel<String>(m_sAudioInput));
|
||||
m_cmbAudioInput.setBounds(240, 51, 177, 21);
|
||||
getContentPane().add(m_cmbAudioInput);
|
||||
|
||||
m_sliderVolume = new JSlider();
|
||||
m_sliderVolume.addChangeListener(new ChangeListener() {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
if ((JSlider)e.getSource() == m_sliderVolume)
|
||||
{
|
||||
m_textFieldInputVolume.setText(""+m_sliderVolume.getValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
m_sliderVolume.setBounds(240, 81, 177, 21);
|
||||
getContentPane().add(m_sliderVolume);
|
||||
|
||||
m_cmbNoiseFilter = new JComboBox<String>();
|
||||
m_cmbNoiseFilter.setModel(new DefaultComboBoxModel<String>(m_sNoiseFilter));
|
||||
m_cmbNoiseFilter.setBounds(240, 111, 177, 21);
|
||||
getContentPane().add(m_cmbNoiseFilter);
|
||||
|
||||
m_textFieldInputVolume = new JTextField();
|
||||
m_textFieldInputVolume.setText("50");
|
||||
m_textFieldInputVolume.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
m_textFieldInputVolume.setEditable(false);
|
||||
m_textFieldInputVolume.setColumns(10);
|
||||
m_textFieldInputVolume.setBounds(427, 81, 32, 21);
|
||||
getContentPane().add(m_textFieldInputVolume);
|
||||
|
||||
JButton btnSet = new JButton("Set");
|
||||
btnSet.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
SetAudioInputStru(m_struAduioInputParam);
|
||||
Pointer lpNetDvrAduioInputParam = m_struAduioInputParam.getPointer();
|
||||
|
||||
m_struAduioInputParam.write();
|
||||
if (false == hCNetSDK.NET_DVR_SetDVRConfig(m_lUserID, HCNetSDK.NET_DVR_SET_AUDIO_INPUT, new NativeLong(m_iChanNum), lpNetDvrAduioInputParam, m_struAduioInputParam.size()))
|
||||
{
|
||||
int iErr = hCNetSDK.NET_DVR_GetLastError();
|
||||
DialogMessage dlg = new DialogMessage("set failed,error code is: "+iErr);
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("set succeed!");
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
m_struAduioInputParam.read();
|
||||
}
|
||||
});
|
||||
btnSet.setBounds(335, 161, 82, 23);
|
||||
getContentPane().add(btnSet);
|
||||
|
||||
JButton btnGet = new JButton("Get");
|
||||
btnGet.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
IntByReference ibrBytesReturned = new IntByReference(0);
|
||||
m_struAduioInputParam.write();
|
||||
Pointer lpNetDvrAduioInputParam = m_struAduioInputParam.getPointer();
|
||||
if (false == hCNetSDK.NET_DVR_GetDVRConfig(m_lUserID, HCNetSDK.NET_DVR_GET_AUDIO_INPUT, new NativeLong(m_iChanNum), lpNetDvrAduioInputParam, m_struAduioInputParam.size(), ibrBytesReturned))
|
||||
{
|
||||
int iErr = hCNetSDK.NET_DVR_GetLastError();
|
||||
DialogMessage dlg = new DialogMessage("get failed,error code is: "+iErr);
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("get succeed!");
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
m_struAduioInputParam.read();
|
||||
|
||||
GetAudioInputStru(m_struAduioInputParam);
|
||||
}
|
||||
});
|
||||
btnGet.setBounds(111, 161, 82, 23);
|
||||
getContentPane().add(btnGet);
|
||||
}
|
||||
|
||||
private void GetAudioInputStru(HCNetSDK.NET_DVR_AUDIO_INPUT_PARAM struAduioInputParam)
|
||||
{
|
||||
m_cmbAudioInput.setSelectedIndex(struAduioInputParam.byAudioInputType);
|
||||
m_sliderVolume.setValue(struAduioInputParam.byVolume);
|
||||
m_cmbNoiseFilter.setSelectedIndex(struAduioInputParam.byEnableNoiseFilter);
|
||||
}
|
||||
|
||||
private void SetAudioInputStru(HCNetSDK.NET_DVR_AUDIO_INPUT_PARAM struAduioInputParam)
|
||||
{
|
||||
struAduioInputParam.byAudioInputType = (byte)m_cmbAudioInput.getSelectedIndex();
|
||||
struAduioInputParam.byVolume = (byte)m_sliderVolume.getValue();
|
||||
struAduioInputParam.byEnableNoiseFilter = (byte)m_cmbNoiseFilter.getSelectedIndex();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package test;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
|
||||
import javax.swing.JCheckBox;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ColorUIResource;
|
||||
import javax.swing.tree.TreeCellRenderer;
|
||||
|
||||
public class CheckBoxTreeCellRenderer extends JPanel implements TreeCellRenderer
|
||||
{
|
||||
protected JCheckBox check;
|
||||
protected CheckBoxTreeLabel label;
|
||||
|
||||
public CheckBoxTreeCellRenderer()
|
||||
{
|
||||
setLayout(null);
|
||||
add(check = new JCheckBox());
|
||||
add(label = new CheckBoxTreeLabel());
|
||||
check.setBackground(UIManager.getColor("Tree.textBackground"));
|
||||
label.setForeground(UIManager.getColor("Tree.textForeground"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Component getTreeCellRendererComponent(JTree tree, Object value,
|
||||
boolean selected, boolean expanded, boolean leaf, int row,
|
||||
boolean hasFocus)
|
||||
{
|
||||
String stringValue = tree.convertValueToText(value, selected, expanded, leaf, row, hasFocus);
|
||||
setEnabled(tree.isEnabled());
|
||||
check.setSelected(((CheckBoxTreeNode)value).isSelected());
|
||||
label.setFont(tree.getFont());
|
||||
label.setText(stringValue);
|
||||
label.setSelected(selected);
|
||||
label.setFocus(hasFocus);
|
||||
if(leaf)
|
||||
label.setIcon(UIManager.getIcon("Tree.leafIcon"));
|
||||
else if(expanded)
|
||||
label.setIcon(UIManager.getIcon("Tree.openIcon"));
|
||||
else
|
||||
label.setIcon(UIManager.getIcon("Tree.closedIcon"));
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize()
|
||||
{
|
||||
Dimension dCheck = check.getPreferredSize();
|
||||
Dimension dLabel = label.getPreferredSize();
|
||||
return new Dimension(dCheck.width + dLabel.width, dCheck.height < dLabel.height ? dLabel.height: dCheck.height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doLayout()
|
||||
{
|
||||
Dimension dCheck = check.getPreferredSize();
|
||||
Dimension dLabel = label.getPreferredSize();
|
||||
int yCheck = 0;
|
||||
int yLabel = 0;
|
||||
if(dCheck.height < dLabel.height)
|
||||
yCheck = (dLabel.height - dCheck.height) / 2;
|
||||
else
|
||||
yLabel = (dCheck.height - dLabel.height) / 2;
|
||||
check.setLocation(0, yCheck);
|
||||
check.setBounds(0, yCheck, dCheck.width, dCheck.height);
|
||||
label.setLocation(dCheck.width, yLabel);
|
||||
label.setBounds(dCheck.width, yLabel, dLabel.width, dLabel.height);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBackground(Color color)
|
||||
{
|
||||
if(color instanceof ColorUIResource)
|
||||
color = null;
|
||||
super.setBackground(color);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package test;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
|
||||
import javax.swing.Icon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.plaf.ColorUIResource;
|
||||
|
||||
public class CheckBoxTreeLabel extends JLabel
|
||||
{
|
||||
private boolean isSelected;
|
||||
private boolean hasFocus;
|
||||
|
||||
public CheckBoxTreeLabel()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBackground(Color color)
|
||||
{
|
||||
if(color instanceof ColorUIResource)
|
||||
color = null;
|
||||
super.setBackground(color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paint(Graphics g)
|
||||
{
|
||||
String str;
|
||||
if((str = getText()) != null)
|
||||
{
|
||||
if(0 < str.length())
|
||||
{
|
||||
if(isSelected)
|
||||
g.setColor(UIManager.getColor("Tree.selectionBackground"));
|
||||
else
|
||||
g.setColor(UIManager.getColor("Tree.textBackground"));
|
||||
Dimension d = getPreferredSize();
|
||||
int imageOffset = 0;
|
||||
Icon currentIcon = getIcon();
|
||||
if(currentIcon != null)
|
||||
imageOffset = currentIcon.getIconWidth() + Math.max(0, getIconTextGap() - 1);
|
||||
g.fillRect(imageOffset, 0, d.width - 1 - imageOffset, d.height);
|
||||
if(hasFocus)
|
||||
{
|
||||
g.setColor(UIManager.getColor("Tree.selectionBorderColor"));
|
||||
g.drawRect(imageOffset, 0, d.width - 1 - imageOffset, d.height - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
super.paint(g);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension getPreferredSize()
|
||||
{
|
||||
Dimension retDimension = super.getPreferredSize();
|
||||
if(retDimension != null)
|
||||
retDimension = new Dimension(retDimension.width + 3, retDimension.height);
|
||||
return retDimension;
|
||||
}
|
||||
|
||||
public void setSelected(boolean isSelected)
|
||||
{
|
||||
this.isSelected = isSelected;
|
||||
}
|
||||
|
||||
public void setFocus(boolean hasFocus)
|
||||
{
|
||||
this.hasFocus = hasFocus;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
package test;
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
|
||||
|
||||
public class CheckBoxTreeNode extends DefaultMutableTreeNode
|
||||
{
|
||||
protected boolean isSelected;
|
||||
|
||||
public CheckBoxTreeNode()
|
||||
{
|
||||
this(null);
|
||||
}
|
||||
|
||||
public CheckBoxTreeNode(Object userObject)
|
||||
{
|
||||
this(userObject, true, false);
|
||||
}
|
||||
|
||||
public CheckBoxTreeNode(Object userObject, boolean allowsChildren, boolean isSelected)
|
||||
{
|
||||
super(userObject, allowsChildren);
|
||||
this.isSelected = isSelected;
|
||||
}
|
||||
|
||||
public boolean isSelected()
|
||||
{
|
||||
return isSelected;
|
||||
}
|
||||
|
||||
public void setSelected(boolean _isSelected)
|
||||
{
|
||||
this.isSelected = _isSelected;
|
||||
|
||||
if(_isSelected)
|
||||
{
|
||||
if(children != null)
|
||||
{
|
||||
for(Object obj : children)
|
||||
{
|
||||
CheckBoxTreeNode node = (CheckBoxTreeNode)obj;
|
||||
if(_isSelected != node.isSelected())
|
||||
node.setSelected(_isSelected);
|
||||
}
|
||||
}
|
||||
CheckBoxTreeNode pNode = (CheckBoxTreeNode)parent;
|
||||
if(pNode != null)
|
||||
{
|
||||
int index = 0;
|
||||
for(; index < pNode.children.size(); ++ index)
|
||||
{
|
||||
CheckBoxTreeNode pChildNode = (CheckBoxTreeNode)pNode.children.get(index);
|
||||
if(!pChildNode.isSelected())
|
||||
break;
|
||||
}
|
||||
if(index == pNode.children.size())
|
||||
{
|
||||
if(pNode.isSelected() != _isSelected)
|
||||
pNode.setSelected(_isSelected);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(children != null)
|
||||
{
|
||||
int index = 0;
|
||||
for(; index < children.size(); ++ index)
|
||||
{
|
||||
CheckBoxTreeNode childNode = (CheckBoxTreeNode)children.get(index);
|
||||
if(!childNode.isSelected())
|
||||
break;
|
||||
}
|
||||
if(index == children.size())
|
||||
{
|
||||
for(int i = 0; i < children.size(); ++ i)
|
||||
{
|
||||
CheckBoxTreeNode node = (CheckBoxTreeNode)children.get(i);
|
||||
if(node.isSelected() != _isSelected)
|
||||
node.setSelected(_isSelected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CheckBoxTreeNode pNode = (CheckBoxTreeNode)parent;
|
||||
if(pNode != null && pNode.isSelected() != _isSelected)
|
||||
pNode.setSelected(_isSelected);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package test;
|
||||
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.tree.DefaultTreeModel;
|
||||
import javax.swing.tree.TreePath;
|
||||
|
||||
public class CheckBoxTreeNodeSelectionListener extends MouseAdapter
|
||||
{
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent event)
|
||||
{
|
||||
JTree tree = (JTree)event.getSource();
|
||||
int x = event.getX();
|
||||
int y = event.getY();
|
||||
int row = tree.getRowForLocation(x, y);
|
||||
TreePath path = tree.getPathForRow(row);
|
||||
if(path != null)
|
||||
{
|
||||
CheckBoxTreeNode node = (CheckBoxTreeNode)path.getLastPathComponent();
|
||||
if(node != null)
|
||||
{
|
||||
boolean isSelected = !node.isSelected();
|
||||
node.setSelected(isSelected);
|
||||
((DefaultTreeModel)tree.getModel()).nodeStructureChanged(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package test;
|
||||
|
||||
import com.sun.jna.NativeLong;
|
||||
|
||||
public class DeviceInfo
|
||||
{
|
||||
private String m_sDVRIP;
|
||||
private short m_wDVRPort;
|
||||
private String m_sUserName;
|
||||
private String m_sPassword;
|
||||
private NativeLong m_nUserID;
|
||||
HCNetSDK.NET_DVR_DEVICEINFO_V30 m_lpDeviceInfo;
|
||||
|
||||
NativeLong m_lAlarmHandle;//guading handle
|
||||
NativeLong m_lListenHandle;//listening handle
|
||||
|
||||
DeviceInfo(String sDVRIP, short wDVRPort, String sUserName, String sPassword, HCNetSDK.NET_DVR_DEVICEINFO_V30 lpDeviceInfo,NativeLong nUserID)
|
||||
{
|
||||
m_sDVRIP=sDVRIP;
|
||||
m_wDVRPort=wDVRPort;
|
||||
m_sUserName=sUserName;
|
||||
m_sPassword=sPassword;
|
||||
m_nUserID=nUserID;
|
||||
m_lpDeviceInfo=lpDeviceInfo;
|
||||
m_lAlarmHandle=new NativeLong(-1);
|
||||
m_lListenHandle=new NativeLong(-1);
|
||||
|
||||
}
|
||||
|
||||
void SetNUserID(NativeLong nUserID)
|
||||
{
|
||||
m_nUserID=nUserID;
|
||||
}
|
||||
|
||||
String GetIP()
|
||||
{
|
||||
return m_sDVRIP;
|
||||
}
|
||||
|
||||
short GetPort()
|
||||
{
|
||||
return m_wDVRPort;
|
||||
}
|
||||
|
||||
String GetUserName()
|
||||
{
|
||||
return m_sUserName;
|
||||
}
|
||||
|
||||
String GetPassword()
|
||||
{
|
||||
return m_sPassword;
|
||||
}
|
||||
|
||||
NativeLong GetNUserID()
|
||||
{
|
||||
return m_nUserID;
|
||||
}
|
||||
|
||||
HCNetSDK.NET_DVR_DEVICEINFO_V30 GetlpDeviceInfo()
|
||||
{
|
||||
return m_lpDeviceInfo;
|
||||
}
|
||||
|
||||
NativeLong GetAlarmHandle()
|
||||
{
|
||||
return m_lAlarmHandle;
|
||||
}
|
||||
|
||||
void SetAlarmHandle(NativeLong lAlarm)
|
||||
{
|
||||
m_lAlarmHandle=lAlarm;
|
||||
}
|
||||
|
||||
NativeLong GetListenHandle()
|
||||
{
|
||||
return m_lListenHandle;
|
||||
}
|
||||
|
||||
void SetListenHandle(NativeLong lListen)
|
||||
{
|
||||
m_lListenHandle=lListen;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,238 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
/*
|
||||
* JDialogCheckTime.java
|
||||
*
|
||||
* Created on 2009-10-9, 14:41:20
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
package test;
|
||||
|
||||
import com.sun.jna.NativeLong;
|
||||
import com.sun.jna.Pointer;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import javax.swing.GroupLayout;
|
||||
import javax.swing.LayoutStyle.ComponentPlacement;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.JLabel;
|
||||
public class DialogCheckTime extends javax.swing.JDialog
|
||||
{
|
||||
|
||||
static HCNetSDK hCNetSDK = HCNetSDK.INSTANCE;
|
||||
private NativeLong m_lUserId;//LogID
|
||||
|
||||
public DialogCheckTime(java.awt.Frame parent, boolean modal, NativeLong userId)
|
||||
{
|
||||
super(parent, modal);
|
||||
initComponents();
|
||||
m_lUserId = userId;
|
||||
Date today = new Date();
|
||||
Calendar now = Calendar.getInstance();//get current time
|
||||
now.setTime(today);
|
||||
jTextFieldYear.setText(now.get(Calendar.YEAR) + "");
|
||||
jTextFieldMonth.setText((now.get(Calendar.MONTH) + 1) + "");
|
||||
jTextFieldDay.setText(now.get(Calendar.DATE) + "");
|
||||
jTextFieldHour.setText(now.get(Calendar.HOUR_OF_DAY) + "");
|
||||
jTextFieldMinute.setText(now.get(Calendar.MINUTE) + "");
|
||||
jTextFieldSecond.setText(now.get(Calendar.SECOND) + "");
|
||||
setModal(true);
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void initComponents() {
|
||||
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
jToggleButtonExit = new javax.swing.JToggleButton();
|
||||
jTextFieldDay = new javax.swing.JTextField();
|
||||
jToggleButtonCheckTime = new javax.swing.JToggleButton();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
jLabel2.setFont(UIManager.getFont("CheckBox.font"));
|
||||
jTextFieldHour = new javax.swing.JTextField();
|
||||
jLabel3 = new javax.swing.JLabel();
|
||||
jTextFieldMonth = new javax.swing.JTextField();
|
||||
jLabel6 = new javax.swing.JLabel();
|
||||
jTextFieldYear = new javax.swing.JTextField();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jTextFieldMinute = new javax.swing.JTextField();
|
||||
jLabel4 = new javax.swing.JLabel();
|
||||
jTextFieldSecond = new javax.swing.JTextField();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setTitle("CheckTime");
|
||||
|
||||
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
|
||||
|
||||
jToggleButtonExit.setText("Exit");
|
||||
jToggleButtonExit.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jToggleButtonExitActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jToggleButtonCheckTime.setText("Check");
|
||||
jToggleButtonCheckTime.addActionListener(new java.awt.event.ActionListener() {
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt) {
|
||||
jToggleButtonCheckTimeActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel2.setText(" M");
|
||||
|
||||
jLabel3.setText("D");
|
||||
|
||||
jLabel6.setText("S");
|
||||
|
||||
jLabel1.setText("Y");
|
||||
|
||||
jLabel4.setText("H");
|
||||
|
||||
JLabel lblM = new JLabel();
|
||||
lblM.setText(" M");
|
||||
lblM.setFont(UIManager.getFont("CheckBox.font"));
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1Layout.setHorizontalGroup(
|
||||
jPanel1Layout.createParallelGroup(Alignment.TRAILING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGap(17)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(Alignment.TRAILING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(jTextFieldHour, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(jLabel4, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(jTextFieldYear, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(jLabel1, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE)))
|
||||
.addComponent(jToggleButtonCheckTime, 0, 0, Short.MAX_VALUE))
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(jTextFieldMonth, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(3)
|
||||
.addComponent(jLabel2, GroupLayout.PREFERRED_SIZE, 34, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(jTextFieldDay, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE))
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(jTextFieldMinute, GroupLayout.PREFERRED_SIZE, 40, GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(2)
|
||||
.addComponent(lblM, GroupLayout.PREFERRED_SIZE, 34, GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addComponent(jTextFieldSecond, GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE))
|
||||
.addComponent(jToggleButtonExit, Alignment.TRAILING))
|
||||
.addPreferredGap(ComponentPlacement.RELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(Alignment.LEADING)
|
||||
.addComponent(jLabel6, GroupLayout.PREFERRED_SIZE, 43, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel3, GroupLayout.PREFERRED_SIZE, 27, GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap())
|
||||
);
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addGap(20)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(jTextFieldYear, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel1)
|
||||
.addComponent(jTextFieldMonth, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel2)
|
||||
.addComponent(jTextFieldDay, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel3))
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(jTextFieldHour, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel4)
|
||||
.addComponent(jTextFieldMinute, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabel6)
|
||||
.addComponent(jTextFieldSecond, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(lblM))
|
||||
.addGap(29)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(Alignment.BASELINE)
|
||||
.addComponent(jToggleButtonExit)
|
||||
.addComponent(jToggleButtonCheckTime))
|
||||
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup()
|
||||
.addContainerGap()
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
);
|
||||
|
||||
getAccessibleContext().setAccessibleName(null);
|
||||
|
||||
pack();
|
||||
}
|
||||
|
||||
//exit
|
||||
private void jToggleButtonExitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButtonExitActionPerformed
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
|
||||
//check
|
||||
private void jToggleButtonCheckTimeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jToggleButtonCheckTimeActionPerformed
|
||||
HCNetSDK.NET_DVR_TIME strCurTime = new HCNetSDK.NET_DVR_TIME();
|
||||
strCurTime.dwYear = Integer.parseInt(jTextFieldYear.getText());
|
||||
strCurTime.dwMonth = Integer.parseInt(jTextFieldMonth.getText());
|
||||
strCurTime.dwDay = Integer.parseInt(jTextFieldDay.getText());
|
||||
strCurTime.dwHour = Integer.parseInt(jTextFieldHour.getText());
|
||||
strCurTime.dwMinute = Integer.parseInt(jTextFieldMinute.getText());
|
||||
strCurTime.dwSecond = Integer.parseInt(jTextFieldSecond.getText());
|
||||
strCurTime.write();
|
||||
Pointer lpPicConfig = strCurTime.getPointer();
|
||||
boolean setDVRConfigSuc = hCNetSDK.NET_DVR_SetDVRConfig(m_lUserId, HCNetSDK.NET_DVR_SET_TIMECFG,
|
||||
new NativeLong(0), lpPicConfig, strCurTime.size());
|
||||
strCurTime.read();
|
||||
if (setDVRConfigSuc != true)
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("check time fail");
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
} else
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("check time success");
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabel3;
|
||||
private javax.swing.JLabel jLabel4;
|
||||
private javax.swing.JLabel jLabel6;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JTextField jTextFieldDay;
|
||||
private javax.swing.JTextField jTextFieldHour;
|
||||
private javax.swing.JTextField jTextFieldMinute;
|
||||
private javax.swing.JTextField jTextFieldMonth;
|
||||
private javax.swing.JTextField jTextFieldSecond;
|
||||
private javax.swing.JTextField jTextFieldYear;
|
||||
private javax.swing.JToggleButton jToggleButtonCheckTime;
|
||||
private javax.swing.JToggleButton jToggleButtonExit;
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
package test;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
import com.sun.jna.NativeLong;
|
||||
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.border.EtchedBorder;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
public class DialogCruiseRoute extends JDialog
|
||||
{
|
||||
|
||||
private final JPanel contentPanel = new JPanel();
|
||||
private JComboBox comboBoxCruiseRoute;
|
||||
private JComboBox comboBoxCruisePoint;
|
||||
private JComboBox comboBoxPresetPoint;
|
||||
private JComboBox comboBoxTime;
|
||||
private JComboBox comboBoxSpeed;
|
||||
|
||||
public static final int MAX_CRUISE_ROUTE = 32;
|
||||
public static final int MAX_CRUISE_POINT = 32;
|
||||
public static final int MAX_CRUISE_PRESET = 255;
|
||||
public static final int MAX_CRUISE_TIME = 255;
|
||||
public static final int MAX_CRUISE_SPEED = 40;
|
||||
|
||||
static HCNetSDK hCNetSDK = HCNetSDK.INSTANCE;
|
||||
private NativeLong m_lRealHandle;
|
||||
|
||||
|
||||
/**
|
||||
* Create the dialog.
|
||||
*/
|
||||
public DialogCruiseRoute(NativeLong lRealHandle)
|
||||
{
|
||||
super();
|
||||
InitComponents();
|
||||
InitDialog();
|
||||
m_lRealHandle = lRealHandle;
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
public void InitComponents()
|
||||
{
|
||||
setTitle("Set CruiseRoute");
|
||||
setBounds(100, 100, 450, 236);
|
||||
getContentPane().setLayout(new BorderLayout());
|
||||
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
getContentPane().add(contentPanel, BorderLayout.CENTER);
|
||||
contentPanel.setLayout(null);
|
||||
{
|
||||
JLabel lblNewLabel = new JLabel("CruiseRoute");
|
||||
lblNewLabel.setBounds(26, 24, 54, 15);
|
||||
contentPanel.add(lblNewLabel);
|
||||
}
|
||||
{
|
||||
comboBoxCruiseRoute = new JComboBox();
|
||||
comboBoxCruiseRoute.setBounds(90, 21, 92, 21);
|
||||
contentPanel.add(comboBoxCruiseRoute);
|
||||
}
|
||||
{
|
||||
JLabel lblNewLabel_1 = new JLabel("Cruise Point");
|
||||
lblNewLabel_1.setBounds(26, 71, 54, 15);
|
||||
contentPanel.add(lblNewLabel_1);
|
||||
}
|
||||
{
|
||||
comboBoxCruisePoint = new JComboBox();
|
||||
comboBoxCruisePoint.setBounds(75, 65, 41, 21);
|
||||
contentPanel.add(comboBoxCruisePoint);
|
||||
}
|
||||
{
|
||||
JLabel label = new JLabel("Preset Point");
|
||||
label.setBounds(122, 71, 54, 15);
|
||||
contentPanel.add(label);
|
||||
}
|
||||
{
|
||||
comboBoxPresetPoint = new JComboBox();
|
||||
comboBoxPresetPoint.setBounds(168, 65, 41, 21);
|
||||
contentPanel.add(comboBoxPresetPoint);
|
||||
}
|
||||
{
|
||||
JLabel label = new JLabel("Time");
|
||||
label.setBounds(216, 71, 54, 15);
|
||||
contentPanel.add(label);
|
||||
}
|
||||
{
|
||||
comboBoxTime = new JComboBox();
|
||||
comboBoxTime.setBounds(265, 65, 41, 21);
|
||||
contentPanel.add(comboBoxTime);
|
||||
}
|
||||
{
|
||||
JLabel label = new JLabel("Speed");
|
||||
label.setBounds(312, 71, 54, 15);
|
||||
contentPanel.add(label);
|
||||
}
|
||||
{
|
||||
comboBoxSpeed = new JComboBox();
|
||||
comboBoxSpeed.setBounds(358, 65, 41, 21);
|
||||
contentPanel.add(comboBoxSpeed);
|
||||
}
|
||||
{
|
||||
JButton btnNewButtonAdd = new JButton("Add CruisePoint");
|
||||
btnNewButtonAdd.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
AddPointActionPerformed(e);
|
||||
}
|
||||
});
|
||||
btnNewButtonAdd.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
btnNewButtonAdd.setBounds(26, 130, 93, 23);
|
||||
contentPanel.add(btnNewButtonAdd);
|
||||
}
|
||||
{
|
||||
JButton buttonDel = new JButton("Delete CruisePoint");
|
||||
buttonDel.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
DelPointActionPerformed(e);
|
||||
}
|
||||
});
|
||||
buttonDel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonDel.setBounds(159, 130, 93, 23);
|
||||
contentPanel.add(buttonDel);
|
||||
}
|
||||
{
|
||||
JButton buttonExit = new JButton("Exit");
|
||||
buttonExit.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ExitActionPerformed(e);
|
||||
}
|
||||
});
|
||||
buttonExit.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonExit.setBounds(286, 130, 93, 23);
|
||||
contentPanel.add(buttonExit);
|
||||
}
|
||||
{
|
||||
JPanel buttonPane = new JPanel();
|
||||
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
|
||||
getContentPane().add(buttonPane, BorderLayout.SOUTH);
|
||||
}
|
||||
}
|
||||
|
||||
public void InitDialog()
|
||||
{
|
||||
int i=0;
|
||||
for(i = 0; i< MAX_CRUISE_ROUTE; i++)
|
||||
{
|
||||
comboBoxCruiseRoute.addItem("CruiseRoute"+(i+1));
|
||||
}
|
||||
for(i = 0; i < MAX_CRUISE_POINT; i++)
|
||||
{
|
||||
comboBoxCruisePoint.addItem(i+1);
|
||||
}
|
||||
for(i = 0;i<MAX_CRUISE_PRESET;i++)
|
||||
{
|
||||
comboBoxPresetPoint.addItem(i+1);
|
||||
}
|
||||
for(i = 0;i<MAX_CRUISE_SPEED;i++)
|
||||
{
|
||||
comboBoxSpeed.addItem(i+1);
|
||||
}
|
||||
for(i=0;i<MAX_CRUISE_TIME;i++)
|
||||
{
|
||||
comboBoxTime.addItem(i+1);
|
||||
}
|
||||
}
|
||||
|
||||
//add cruite point
|
||||
public void AddPointActionPerformed(ActionEvent event)
|
||||
{
|
||||
byte byCruiseRoute = (byte)(comboBoxCruiseRoute.getSelectedIndex()+1);
|
||||
byte byCruisePoint = (byte)(comboBoxPresetPoint.getSelectedIndex()+1);
|
||||
short sPresetPoint = (short)(comboBoxPresetPoint.getSelectedIndex()+1);
|
||||
short sTime = (short)(comboBoxTime.getSelectedIndex()+1);
|
||||
short sSpeed = (short)(comboBoxSpeed.getSelectedIndex()+1);
|
||||
boolean bRet = false;
|
||||
bRet = hCNetSDK.NET_DVR_PTZCruise(m_lRealHandle,HCNetSDK.FILL_PRE_SEQ,byCruiseRoute,byCruisePoint,sPresetPoint);
|
||||
if(bRet)
|
||||
{
|
||||
bRet = hCNetSDK.NET_DVR_PTZCruise(m_lRealHandle,HCNetSDK.SET_SEQ_DWELL,byCruiseRoute,byCruisePoint,sTime);
|
||||
if(bRet)
|
||||
{
|
||||
bRet = hCNetSDK.NET_DVR_PTZCruise(m_lRealHandle,HCNetSDK.SET_SEQ_SPEED,byCruiseRoute,byCruisePoint,sSpeed);
|
||||
}
|
||||
}
|
||||
if(!bRet)
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("add fail,error code:"+hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//delete cruise route point
|
||||
public void DelPointActionPerformed(ActionEvent event)
|
||||
{
|
||||
byte byCruiseRoute = (byte)(comboBoxCruiseRoute.getSelectedIndex()+1);
|
||||
byte byCruisePoint = (byte)(comboBoxPresetPoint.getSelectedIndex()+1);
|
||||
short sPresetPoint = (short)(comboBoxPresetPoint.getSelectedIndex()+1);
|
||||
if(!hCNetSDK.NET_DVR_PTZCruise(m_lRealHandle,HCNetSDK.CLE_PRE_SEQ,byCruiseRoute,byCruisePoint,sPresetPoint))
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("delete fail,error code:"+hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//exit
|
||||
public void ExitActionPerformed(ActionEvent e)
|
||||
{
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package test;
|
||||
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class DialogDeviceAttribute extends JDialog
|
||||
{
|
||||
private JTextField textFieldIP;
|
||||
private JTextField textFieldPort;
|
||||
private JTextField textFieldUserName;
|
||||
private JTextField textFieldPassword;
|
||||
private JTextField textFieldDeviceType;
|
||||
private JTextField textFieldSerialNum;
|
||||
private JTextField textFieldChannelNum;
|
||||
|
||||
public DialogDeviceAttribute(DeviceInfo deviceInfo)
|
||||
{
|
||||
setTitle("Device Attribute");
|
||||
InitialDialog();
|
||||
ShowMessage(deviceInfo);
|
||||
setModal(true);
|
||||
|
||||
}
|
||||
private void InitialDialog()
|
||||
{
|
||||
getContentPane().setLayout(null);
|
||||
|
||||
JLabel label = new JLabel("IP:");
|
||||
label.setBounds(23, 13, 54, 15);
|
||||
getContentPane().add(label);
|
||||
|
||||
textFieldIP = new JTextField();
|
||||
textFieldIP.setColumns(10);
|
||||
textFieldIP.setBounds(92, 10, 106, 21);
|
||||
getContentPane().add(textFieldIP);
|
||||
|
||||
JLabel label_1 = new JLabel("Port:");
|
||||
label_1.setBounds(219, 13, 54, 15);
|
||||
getContentPane().add(label_1);
|
||||
|
||||
textFieldPort = new JTextField();
|
||||
textFieldPort.setColumns(10);
|
||||
textFieldPort.setBounds(292, 10, 98, 21);
|
||||
getContentPane().add(textFieldPort);
|
||||
|
||||
JLabel label_2 = new JLabel("UserName:");
|
||||
label_2.setBounds(23, 64, 54, 15);
|
||||
getContentPane().add(label_2);
|
||||
|
||||
textFieldUserName = new JTextField();
|
||||
textFieldUserName.setColumns(10);
|
||||
textFieldUserName.setBounds(92, 61, 106, 21);
|
||||
getContentPane().add(textFieldUserName);
|
||||
|
||||
JLabel label_3 = new JLabel("Password:");
|
||||
label_3.setBounds(219, 64, 54, 15);
|
||||
getContentPane().add(label_3);
|
||||
|
||||
textFieldPassword = new JTextField();
|
||||
textFieldPassword.setColumns(10);
|
||||
textFieldPassword.setBounds(292, 61, 98, 21);
|
||||
getContentPane().add(textFieldPassword);
|
||||
|
||||
JLabel label_4 = new JLabel("Device Type");
|
||||
label_4.setBounds(23, 115, 54, 15);
|
||||
getContentPane().add(label_4);
|
||||
|
||||
textFieldDeviceType = new JTextField();
|
||||
textFieldDeviceType.setColumns(10);
|
||||
textFieldDeviceType.setBounds(92, 112, 106, 21);
|
||||
getContentPane().add(textFieldDeviceType);
|
||||
|
||||
JLabel label_5 = new JLabel("Serial NO:");
|
||||
label_5.setBounds(23, 167, 63, 15);
|
||||
getContentPane().add(label_5);
|
||||
|
||||
textFieldSerialNum = new JTextField();
|
||||
textFieldSerialNum.setColumns(10);
|
||||
textFieldSerialNum.setBounds(92, 164, 298, 21);
|
||||
getContentPane().add(textFieldSerialNum);
|
||||
|
||||
JLabel label_6 = new JLabel("Channel NUM:");
|
||||
label_6.setBounds(219, 115, 54, 15);
|
||||
getContentPane().add(label_6);
|
||||
|
||||
textFieldChannelNum = new JTextField();
|
||||
textFieldChannelNum.setColumns(10);
|
||||
textFieldChannelNum.setBounds(292, 112, 98, 21);
|
||||
getContentPane().add(textFieldChannelNum);
|
||||
}
|
||||
|
||||
private void ShowMessage(DeviceInfo deviceInfo)
|
||||
{
|
||||
textFieldIP.setText(deviceInfo.GetIP());
|
||||
textFieldPort.setText(Short.toString(deviceInfo.GetPort()));
|
||||
textFieldUserName.setText(deviceInfo.GetUserName());
|
||||
textFieldPassword.setText(deviceInfo.GetPassword());
|
||||
textFieldDeviceType.setText(Byte.toString(deviceInfo.GetlpDeviceInfo().byDVRType));
|
||||
textFieldSerialNum.setText(new String(deviceInfo.GetlpDeviceInfo().sSerialNumber).trim());
|
||||
textFieldChannelNum.setText(Byte.toString(deviceInfo.GetlpDeviceInfo().byChanNum));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
package test;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.tree.DefaultTreeModel;
|
||||
|
||||
import com.sun.jna.NativeLong;
|
||||
import com.sun.jna.Pointer;
|
||||
|
||||
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.Font;
|
||||
|
||||
public class DialogGuard extends JDialog
|
||||
{
|
||||
|
||||
private final JPanel contentPanel = new JPanel();
|
||||
private JTree tree;
|
||||
private DefaultMutableTreeNode m_DeviceRoot;
|
||||
private AlarmThread paAlarmThread;
|
||||
private FMSGCallBack fMSFCallBack;// alarm callback
|
||||
static HCNetSDK hCNetSDK = HCNetSDK.INSTANCE;
|
||||
|
||||
/**
|
||||
* Create the dialog.
|
||||
*/
|
||||
public DialogGuard()
|
||||
{
|
||||
InitComponent();
|
||||
AddNode();
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
public void InitComponent()
|
||||
{
|
||||
setBounds(100, 100, 343, 332);
|
||||
getContentPane().setLayout(new BorderLayout());
|
||||
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
getContentPane().add(contentPanel, BorderLayout.CENTER);
|
||||
contentPanel.setLayout(null);
|
||||
|
||||
JScrollPane scrollPane = new JScrollPane();
|
||||
scrollPane.setBounds(10, 10, 302, 138);
|
||||
contentPanel.add(scrollPane);
|
||||
|
||||
tree = new JTree();
|
||||
scrollPane.setViewportView(tree);
|
||||
tree.setModel(InitialTreeModel());
|
||||
|
||||
JButton btnNewButton = new JButton("Guard/DisGuard");
|
||||
btnNewButton.setFont(new Font("宋体", Font.PLAIN, 10));
|
||||
btnNewButton.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
actionPerformedGuard(e);
|
||||
}
|
||||
});
|
||||
btnNewButton.setBounds(21, 198, 117, 23);
|
||||
contentPanel.add(btnNewButton);
|
||||
|
||||
JButton btnNewButton_1 = new JButton("Exit");
|
||||
btnNewButton_1.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
actionPerformedExit(e);
|
||||
}
|
||||
});
|
||||
btnNewButton_1.setBounds(177, 198, 93, 23);
|
||||
contentPanel.add(btnNewButton_1);
|
||||
tree.addMouseListener(new CheckBoxTreeNodeSelectionListener());
|
||||
|
||||
{
|
||||
JPanel buttonPane = new JPanel();
|
||||
getContentPane().add(buttonPane, BorderLayout.SOUTH);
|
||||
buttonPane.setLayout(null);
|
||||
{
|
||||
JButton okButton = new JButton("OK");
|
||||
okButton.setBounds(319, 5, 45, 23);
|
||||
okButton.setActionCommand("OK");
|
||||
buttonPane.add(okButton);
|
||||
getRootPane().setDefaultButton(okButton);
|
||||
}
|
||||
{
|
||||
JButton cancelButton = new JButton("Cancel");
|
||||
cancelButton.setBounds(369, 5, 69, 23);
|
||||
cancelButton.setActionCommand("Cancel");
|
||||
buttonPane.add(cancelButton);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public DefaultTreeModel InitialTreeModel()
|
||||
{
|
||||
m_DeviceRoot = new CheckBoxTreeNode("Device Tree");
|
||||
DefaultTreeModel checkBoxDefaultTreeModel = new DefaultTreeModel(m_DeviceRoot);
|
||||
return checkBoxDefaultTreeModel;
|
||||
}
|
||||
|
||||
public void AddNode()
|
||||
{
|
||||
|
||||
Iterator iterator = JavaDemo.m_hashDeviceInfo.keySet().iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
String sIp = (String) iterator.next();
|
||||
DefaultTreeModel TreeModel = ((DefaultTreeModel) tree.getModel());
|
||||
CheckBoxTreeNode TreeIP = new CheckBoxTreeNode(sIp);
|
||||
m_DeviceRoot.add(TreeIP);
|
||||
TreeModel.reload();
|
||||
System.out.println(sIp);
|
||||
tree.setCellRenderer(new CheckBoxTreeCellRenderer());
|
||||
}
|
||||
}
|
||||
|
||||
public void actionPerformedGuard(ActionEvent event)
|
||||
{
|
||||
for (Enumeration enu = m_DeviceRoot.children(); enu.hasMoreElements();)
|
||||
{
|
||||
CheckBoxTreeNode node = (CheckBoxTreeNode) enu.nextElement();
|
||||
if (node.isSelected)
|
||||
{
|
||||
String sIP = node.toString();
|
||||
DeviceInfo deviceInfo = JavaDemo.m_hashDeviceInfo.get(sIP);
|
||||
NativeLong lUserID = deviceInfo.GetNUserID();
|
||||
if (lUserID.intValue() == -1)
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("Please login");
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
if (deviceInfo.GetAlarmHandle().intValue() == -1)
|
||||
{
|
||||
if (fMSFCallBack == null)
|
||||
{
|
||||
fMSFCallBack = new FMSGCallBack();
|
||||
Pointer pUser = null;
|
||||
|
||||
if (!hCNetSDK.NET_DVR_SetDVRMessageCallBack_V30(fMSFCallBack, pUser))
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("Set callBack fail,error code:" + hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
paAlarmThread = AlarmThread.getInstance();
|
||||
if(!paAlarmThread.GetStart())
|
||||
{
|
||||
paAlarmThread.start();
|
||||
paAlarmThread.SetStart(true);
|
||||
}
|
||||
}
|
||||
NativeLong lAlarmHandle = hCNetSDK.NET_DVR_SetupAlarmChan_V30(lUserID);
|
||||
deviceInfo.SetAlarmHandle(lAlarmHandle);
|
||||
if (lAlarmHandle.intValue() == -1)
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("Guarding fail,error code:" + hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (deviceInfo.GetAlarmHandle().intValue() != -1)
|
||||
{
|
||||
if (!hCNetSDK.NET_DVR_CloseAlarmChan_V30(deviceInfo.GetAlarmHandle()))
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("Disguarding fail,error code:" + hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
deviceInfo.SetAlarmHandle(new NativeLong(-1));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
deviceInfo.SetAlarmHandle(new NativeLong(-1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class FMSGCallBack implements HCNetSDK.FMSGCallBack
|
||||
{
|
||||
// alarm info call back function
|
||||
|
||||
public void invoke(NativeLong lCommand, HCNetSDK.NET_DVR_ALARMER pAlarmer, HCNetSDK.RECV_ALARM pAlarmInfo,
|
||||
int dwBufLen, Pointer pUser)
|
||||
{
|
||||
QueueMessage queueMessage = new QueueMessage(pAlarmInfo, lCommand, pAlarmer);
|
||||
paAlarmThread.AddMessage(queueMessage);
|
||||
}
|
||||
}
|
||||
|
||||
public void actionPerformedExit(ActionEvent event)
|
||||
{
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
package test;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
import com.sun.corba.se.impl.interceptors.InterceptorInvoker;
|
||||
import com.sun.jna.NativeLong;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.PointerType;
|
||||
import com.sun.jna.ptr.ByteByReference;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
|
||||
import jdk.internal.org.objectweb.asm.tree.IntInsnNode;
|
||||
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JTextField;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
public class DialogListening extends JDialog
|
||||
{
|
||||
|
||||
private final JPanel contentPanel = new JPanel();
|
||||
private JComboBox comboBoxIP;
|
||||
private JTextField textFieldPort;
|
||||
private JComboBox comboBoxIPType;
|
||||
|
||||
|
||||
static HCNetSDK hCNetSDK = HCNetSDK.INSTANCE;
|
||||
FMSGCallBack fMSFCallBack;// alarm callback
|
||||
private AlarmThread paAlarmThread;
|
||||
private String m_ip;
|
||||
private JTextField textFieldIPV6;
|
||||
|
||||
|
||||
/**
|
||||
* Create the dialog.
|
||||
*/
|
||||
public DialogListening(String ip)
|
||||
{
|
||||
InitComponent();
|
||||
m_ip = ip;
|
||||
GetHostIP();
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
public void InitComponent()
|
||||
{
|
||||
setBounds(100, 100, 380, 300);
|
||||
getContentPane().setLayout(new BorderLayout());
|
||||
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
getContentPane().add(contentPanel, BorderLayout.CENTER);
|
||||
contentPanel.setLayout(null);
|
||||
{
|
||||
comboBoxIPType = new JComboBox();
|
||||
comboBoxIPType.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
actionPerformedIPChange(e);
|
||||
}
|
||||
});
|
||||
comboBoxIPType.setModel(new DefaultComboBoxModel(new String[] { "IPV4", "IPV6" }));
|
||||
comboBoxIPType.setBounds(33, 20, 71, 21);
|
||||
contentPanel.add(comboBoxIPType);
|
||||
}
|
||||
|
||||
JLabel lblNewLabel = new JLabel("Binding IP");
|
||||
lblNewLabel.setBounds(138, 23, 54, 15);
|
||||
contentPanel.add(lblNewLabel);
|
||||
|
||||
comboBoxIP = new JComboBox();
|
||||
comboBoxIP.setBounds(185, 20, 115, 21);
|
||||
contentPanel.add(comboBoxIP);
|
||||
|
||||
JButton btnNewButton = new JButton("Refresh IP");
|
||||
btnNewButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
actionPerformedRefresh(e);
|
||||
}
|
||||
});
|
||||
btnNewButton.setBounds(33, 74, 104, 23);
|
||||
contentPanel.add(btnNewButton);
|
||||
|
||||
JButton btnNewButton_1 = new JButton("Binding IP");
|
||||
btnNewButton_1.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
actionPerformedBind(e);
|
||||
}
|
||||
});
|
||||
btnNewButton_1.setBounds(185, 74, 93, 23);
|
||||
contentPanel.add(btnNewButton_1);
|
||||
|
||||
JLabel lblNewLabel_1 = new JLabel("Listening Port");
|
||||
lblNewLabel_1.setBounds(40, 149, 54, 15);
|
||||
contentPanel.add(lblNewLabel_1);
|
||||
|
||||
textFieldPort = new JTextField();
|
||||
textFieldPort.setText("7200");
|
||||
textFieldPort.setBounds(126, 146, 66, 21);
|
||||
contentPanel.add(textFieldPort);
|
||||
textFieldPort.setColumns(10);
|
||||
|
||||
JButton btnNewButton_2 = new JButton("Start Listening");
|
||||
btnNewButton_2.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
actionPerformedListeing(e);
|
||||
}
|
||||
});
|
||||
btnNewButton_2.setBounds(40, 207, 93, 23);
|
||||
contentPanel.add(btnNewButton_2);
|
||||
|
||||
JButton btnNewButton_3 = new JButton("Stop Listening");
|
||||
btnNewButton_3.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
actionPerformedStop(e);
|
||||
}
|
||||
});
|
||||
btnNewButton_3.setBounds(207, 207, 93, 23);
|
||||
contentPanel.add(btnNewButton_3);
|
||||
|
||||
textFieldIPV6 = new JTextField();
|
||||
textFieldIPV6.setBounds(190, 20, 66, 21);
|
||||
contentPanel.add(textFieldIPV6);
|
||||
textFieldIPV6.setColumns(10);
|
||||
{
|
||||
JPanel buttonPane = new JPanel();
|
||||
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
|
||||
getContentPane().add(buttonPane, BorderLayout.SOUTH);
|
||||
}
|
||||
}
|
||||
|
||||
public void actionPerformedListeing(ActionEvent e)
|
||||
{
|
||||
DeviceInfo deviceInfo = JavaDemo.m_hashDeviceInfo.get(m_ip);
|
||||
NativeLong lUserID = deviceInfo.GetNUserID();
|
||||
if (lUserID.intValue() == -1)
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("Please login");
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
String sIP = "";
|
||||
if(comboBoxIPType.getSelectedIndex() == 0)
|
||||
{
|
||||
sIP = (String)comboBoxIP.getSelectedItem();
|
||||
System.out.println("sip="+sIP);
|
||||
}
|
||||
else
|
||||
{
|
||||
sIP = textFieldIPV6.getText();
|
||||
}
|
||||
|
||||
if (deviceInfo.GetListenHandle().intValue() == -1)
|
||||
{
|
||||
if (fMSFCallBack == null)
|
||||
{
|
||||
fMSFCallBack = new FMSGCallBack();
|
||||
}
|
||||
Pointer pUser = null;
|
||||
if (!hCNetSDK.NET_DVR_SetDVRMessageCallBack_V30(fMSFCallBack, pUser))
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("Set callback fail,error code:" + hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
paAlarmThread = AlarmThread.getInstance();
|
||||
if(!paAlarmThread.GetStart())
|
||||
{
|
||||
paAlarmThread.start();
|
||||
paAlarmThread.SetStart(true);
|
||||
}
|
||||
int iPort = Integer.parseInt(textFieldPort.getText());
|
||||
NativeLong lListenHandle = hCNetSDK.NET_DVR_StartListen_V30(sIP, (short) iPort, fMSFCallBack, null);
|
||||
deviceInfo.SetListenHandle(lListenHandle);
|
||||
if (lListenHandle.intValue() == -1)
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("Starting listening fail,error code:" + hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void actionPerformedStop(ActionEvent event)
|
||||
{
|
||||
DeviceInfo deviceInfo = JavaDemo.m_hashDeviceInfo.get(m_ip);
|
||||
if (deviceInfo.GetListenHandle().intValue() != -1)
|
||||
{
|
||||
if (!hCNetSDK.NET_DVR_StopListen_V30(deviceInfo.GetListenHandle()))
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("Stop listening fail,error code:" + hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
deviceInfo.SetListenHandle(new NativeLong(-1));
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
deviceInfo.SetListenHandle(new NativeLong(-1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void actionPerformedRefresh(ActionEvent event)
|
||||
{
|
||||
GetHostIP();
|
||||
}
|
||||
|
||||
public void GetHostIP()
|
||||
{
|
||||
byte[]sAllIP = new byte[16*16];
|
||||
IntByReference ptrdwIpNum = new IntByReference(0);
|
||||
HCNetSDK.Bind b = new HCNetSDK.Bind();
|
||||
b.write();
|
||||
Pointer ptr = b.getPointer();
|
||||
ByteByReference ptrbBind = new ByteByReference((byte)0);
|
||||
if(!hCNetSDK.NET_DVR_GetLocalIP(sAllIP, ptrdwIpNum, ptrbBind))
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("get ip fail,error code:" + hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
b.read();
|
||||
|
||||
System.out.println("num="+ptrdwIpNum.getValue());
|
||||
comboBoxIP.removeAllItems();
|
||||
for(int i=0;i<ptrdwIpNum.getValue();i++)
|
||||
{
|
||||
String str = new String(sAllIP, i*16, 16);
|
||||
comboBoxIP.addItem(str);
|
||||
}
|
||||
comboBoxIP.setSelectedIndex(0);
|
||||
}
|
||||
|
||||
public void actionPerformedBind(ActionEvent event)
|
||||
{
|
||||
int index = comboBoxIP.getSelectedIndex();
|
||||
if(!hCNetSDK.NET_DVR_SetValidIP(index, true))
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("binding ip fail,error code:" + hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void actionPerformedIPChange(ActionEvent event)
|
||||
{
|
||||
if(comboBoxIPType.getSelectedIndex() == 0)
|
||||
{
|
||||
comboBoxIP.setVisible(true);
|
||||
textFieldIPV6.setVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
textFieldIPV6.setVisible(true);
|
||||
comboBoxIP.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
public class FMSGCallBack implements HCNetSDK.FMSGCallBack
|
||||
{
|
||||
// alarm info call back function
|
||||
|
||||
public void invoke(NativeLong lCommand, HCNetSDK.NET_DVR_ALARMER pAlarmer, HCNetSDK.RECV_ALARM pAlarmInfo,
|
||||
int dwBufLen, Pointer pUser)
|
||||
{
|
||||
QueueMessage queueMessage = new QueueMessage(pAlarmInfo, lCommand, pAlarmer);
|
||||
paAlarmThread.AddMessage(queueMessage);
|
||||
System.out.println("------------1");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package test;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPasswordField;
|
||||
import javax.swing.JTextField;
|
||||
|
||||
import com.sun.jna.NativeLong;
|
||||
import com.sun.jna.Pointer;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class DialogLogin extends JDialog
|
||||
{
|
||||
static HCNetSDK hCNetSDK = HCNetSDK.INSTANCE;
|
||||
private int m_iDeviceIndex ;
|
||||
|
||||
|
||||
private JTextField textFieldIP;
|
||||
private JTextField textFieldPort;
|
||||
private JTextField textFieldUserName;
|
||||
private JPasswordField passwordFieldPwd;
|
||||
|
||||
HCNetSDK.NET_DVR_USER_LOGIN_INFO struLoginInfo ;
|
||||
HCNetSDK.NET_DVR_DEVICEINFO_V40 struDeviceInfo;
|
||||
|
||||
public DialogLogin()
|
||||
{
|
||||
m_iDeviceIndex = -1;
|
||||
InitComponent();
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
public void SetDeivceIndex(int i)
|
||||
{
|
||||
m_iDeviceIndex = i;
|
||||
}
|
||||
|
||||
public void InitComponent()
|
||||
{
|
||||
setTitle("Add Device");
|
||||
getContentPane().setLayout(null);
|
||||
|
||||
JLabel lblNewLabel = new JLabel("IP:");
|
||||
lblNewLabel.setBounds(28, 37, 54, 15);
|
||||
getContentPane().add(lblNewLabel);
|
||||
|
||||
textFieldIP = new JTextField();
|
||||
textFieldIP.setText("10.17.133.41");
|
||||
textFieldIP.setBounds(92, 34, 89, 21);
|
||||
getContentPane().add(textFieldIP);
|
||||
textFieldIP.setColumns(10);
|
||||
|
||||
JLabel lblNewLabel_1 = new JLabel("Port:");
|
||||
lblNewLabel_1.setBounds(202, 37, 54, 15);
|
||||
getContentPane().add(lblNewLabel_1);
|
||||
|
||||
textFieldPort = new JTextField();
|
||||
textFieldPort.setText("8000");
|
||||
textFieldPort.setBounds(281, 34, 89, 21);
|
||||
getContentPane().add(textFieldPort);
|
||||
textFieldPort.setColumns(10);
|
||||
|
||||
JLabel lblNewLabel_2 = new JLabel("UserName:");
|
||||
lblNewLabel_2.setBounds(28, 122, 54, 15);
|
||||
getContentPane().add(lblNewLabel_2);
|
||||
|
||||
textFieldUserName = new JTextField();
|
||||
textFieldUserName.setText("admin");
|
||||
textFieldUserName.setBounds(93, 119, 88, 21);
|
||||
getContentPane().add(textFieldUserName);
|
||||
textFieldUserName.setColumns(10);
|
||||
|
||||
JLabel lblNewLabel_3 = new JLabel("Password:");
|
||||
lblNewLabel_3.setBounds(202, 122, 54, 15);
|
||||
getContentPane().add(lblNewLabel_3);
|
||||
|
||||
JButton btnNewButton = new JButton("Login");
|
||||
btnNewButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
LoginActionPerformed(arg0);
|
||||
|
||||
}
|
||||
});
|
||||
btnNewButton.setBounds(86, 200, 78, 23);
|
||||
getContentPane().add(btnNewButton);
|
||||
|
||||
JButton btnNewButton_1 = new JButton("Cancel");
|
||||
btnNewButton_1.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ExitActionPerformed(e);
|
||||
}
|
||||
});
|
||||
btnNewButton_1.setBounds(233, 200, 78, 23);
|
||||
getContentPane().add(btnNewButton_1);
|
||||
|
||||
passwordFieldPwd = new JPasswordField();
|
||||
passwordFieldPwd.setText("12345");
|
||||
passwordFieldPwd.setBounds(281, 119, 89, 21);
|
||||
getContentPane().add(passwordFieldPwd);
|
||||
}
|
||||
|
||||
void LoginActionPerformed(ActionEvent event)
|
||||
{
|
||||
|
||||
String sDeviceIP = textFieldIP.getText();
|
||||
if( textFieldPort.getText() == null || textFieldPort.getText().trim().length() == 0)
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("Port must be not null");
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
|
||||
return;
|
||||
}
|
||||
int iPort = Integer.parseInt(textFieldPort.getText());
|
||||
|
||||
struLoginInfo = new HCNetSDK.NET_DVR_USER_LOGIN_INFO();
|
||||
struDeviceInfo = new HCNetSDK.NET_DVR_DEVICEINFO_V40();
|
||||
Pointer PointerstruDeviceInfoV40 = struDeviceInfo.getPointer();
|
||||
Pointer PointerstruLoginInfo = struLoginInfo.getPointer();
|
||||
|
||||
for(int i=0;i<sDeviceIP.length();i++)
|
||||
{
|
||||
struLoginInfo.sDeviceAddress[i]= (byte)sDeviceIP.charAt(i);
|
||||
}
|
||||
for(int i=0;i<passwordFieldPwd.getPassword().length;i++)
|
||||
{
|
||||
struLoginInfo.sPassword[i]=(byte) passwordFieldPwd.getPassword()[i];
|
||||
}
|
||||
for(int i=0;i<textFieldUserName.getText().length();i++)
|
||||
{
|
||||
struLoginInfo.sUserName[i]=(byte)textFieldUserName.getText().charAt(i);
|
||||
}
|
||||
struLoginInfo.wPort = (short)iPort;
|
||||
struLoginInfo.write();
|
||||
System.out.println("NET_DVR_Login_V40 before");
|
||||
try {
|
||||
//Thread.sleep(1000);
|
||||
NativeLong nlUserID = hCNetSDK.NET_DVR_Login_V40(PointerstruLoginInfo, PointerstruDeviceInfoV40);
|
||||
System.out.println("NET_DVR_Login_V40 after");
|
||||
|
||||
long lUserID = nlUserID.longValue();
|
||||
if (lUserID == -1)
|
||||
{
|
||||
sDeviceIP = "";
|
||||
int ierr = hCNetSDK.NET_DVR_GetLastError();
|
||||
DialogMessage dlg = new DialogMessage("login error,error code:" + ierr);
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
struDeviceInfo.read();
|
||||
//Thread.sleep(300);
|
||||
DeviceInfo deviceInfo=new DeviceInfo(sDeviceIP, (short)iPort, textFieldUserName.getText(),
|
||||
new String(passwordFieldPwd.getPassword()), struDeviceInfo.struDeviceV30, nlUserID);
|
||||
int iRet = JavaDemo.TreeAddDevice(nlUserID,sDeviceIP,struDeviceInfo,deviceInfo);
|
||||
if(iRet == -1)
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("device already login" );
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
this.dispose();
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
void ExitActionPerformed(ActionEvent event)
|
||||
{
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package test;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.JLabel;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
import javax.swing.ImageIcon;
|
||||
import java.awt.Color;
|
||||
|
||||
public class DialogMessage extends JDialog
|
||||
{
|
||||
|
||||
private final JPanel contentPanel = new JPanel();
|
||||
private JLabel InfoText;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create the dialog.
|
||||
*/
|
||||
public DialogMessage(String str)
|
||||
{
|
||||
setTitle("Infomation");
|
||||
InitComponent();
|
||||
InfoText.setText(str);
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
public void InitComponent()
|
||||
{
|
||||
setBounds(100, 100, 413, 207);
|
||||
getContentPane().setLayout(new BorderLayout());
|
||||
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
getContentPane().add(contentPanel, BorderLayout.CENTER);
|
||||
contentPanel.setLayout(null);
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
panel.setBounds(10, 10, 377, 149);
|
||||
contentPanel.add(panel);
|
||||
panel.setLayout(null);
|
||||
|
||||
InfoText = new JLabel("");
|
||||
InfoText.setBounds(62, 30, 305, 47);
|
||||
panel.add(InfoText);
|
||||
|
||||
JButton btnNewButton = new JButton("Sure");
|
||||
btnNewButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent paramActionEvent) {
|
||||
actionPerformedOK(paramActionEvent);
|
||||
|
||||
}
|
||||
});
|
||||
btnNewButton.setBounds(118, 87, 112, 39);
|
||||
panel.add(btnNewButton);
|
||||
|
||||
JLabel lblNewLabel = new JLabel("INFO:");
|
||||
lblNewLabel.setBackground(Color.RED);
|
||||
lblNewLabel.setForeground(Color.RED);
|
||||
lblNewLabel.setBounds(27, 41, 49, 24);
|
||||
panel.add(lblNewLabel);
|
||||
{
|
||||
JPanel buttonPane = new JPanel();
|
||||
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
|
||||
getContentPane().add(buttonPane, BorderLayout.SOUTH);
|
||||
}
|
||||
}
|
||||
|
||||
public void actionPerformedOK(ActionEvent event)
|
||||
{
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,777 @@
|
||||
package test;
|
||||
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import com.sun.javafx.scene.paint.GradientUtils.Point;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.NativeLong;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.examples.win32.W32API.HWND;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
|
||||
import test.HCNetSDK.NET_DVR_PLAYCOND;
|
||||
import test.HCNetSDK.NET_DVR_STREAM_INFO;
|
||||
import test.HCNetSDK.NET_DVR_VOD_PARA;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JTextField;
|
||||
import java.awt.Panel;
|
||||
import javax.swing.JToolBar;
|
||||
import javax.swing.ButtonGroup;
|
||||
import javax.swing.JButton;
|
||||
import java.awt.Color;
|
||||
import javax.swing.JSlider;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Timer;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import javax.swing.JRadioButton;
|
||||
import javax.swing.JRadioButtonMenuItem;
|
||||
import javax.swing.UIManager;
|
||||
import java.awt.Font;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class DialogPlayBackByTime extends JDialog
|
||||
{
|
||||
|
||||
static HCNetSDK hCNetSDK = HCNetSDK.INSTANCE;
|
||||
NativeLong m_lUserID;// logID
|
||||
NativeLong m_lPlayHandle;// playhandle
|
||||
NativeLong m_lLoadHandle;// downloadhandle
|
||||
String m_sDeviceIP;// deviceip
|
||||
int m_iChanShowNum;// playback channel
|
||||
boolean m_bSound;
|
||||
boolean m_bPause;
|
||||
boolean m_bTimeSave;
|
||||
|
||||
Timer Downloadtimer;
|
||||
Timer Playbacktimer;
|
||||
|
||||
private JTextField textFieldsYear;
|
||||
private JTextField textFieldsMonth;
|
||||
private JTextField textFieldsDay;
|
||||
private JTextField textFieldsHour;
|
||||
private JTextField textFieldsMinute;
|
||||
private JTextField textFieldsSecond;
|
||||
private JTextField textFieldeYear;
|
||||
private JTextField textFieldeMonth;
|
||||
private JTextField textFieldeDay;
|
||||
private JTextField textFieldeHour;
|
||||
private JTextField textFieldeMinute;
|
||||
private JTextField textFieldeSecond;
|
||||
private JTextField textFieldChannelNum;
|
||||
private Panel panelPlay;
|
||||
private JButton buttonSave;
|
||||
private JButton buttonExit;
|
||||
private JSlider sliderAudio;
|
||||
private JButton btnNewButtonAudio;
|
||||
private JButton btnNewButtonPlay;
|
||||
private JButton btnNewButtonDownload;
|
||||
private JRadioButton RadioForward;
|
||||
private JRadioButton RadioReverse ;
|
||||
|
||||
public DialogPlayBackByTime(java.awt.Frame parent, boolean modal, NativeLong lUserID, String sIP) {
|
||||
super(parent, modal);
|
||||
setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
initComponents();
|
||||
initialDialog();
|
||||
m_lUserID = lUserID;
|
||||
m_lPlayHandle = new NativeLong(-1);
|
||||
m_lLoadHandle = new NativeLong(-1);
|
||||
m_iChanShowNum = 0;
|
||||
m_sDeviceIP = sIP;
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
private void initComponents() {
|
||||
setTitle("Playback By Time");
|
||||
getContentPane().setLayout(null);
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
panel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Video Time", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
||||
panel.setBounds(10, 10, 663, 113);
|
||||
getContentPane().add(panel);
|
||||
panel.setLayout(null);
|
||||
|
||||
JLabel lblNewLabel = new JLabel("Start Time");
|
||||
lblNewLabel.setBounds(10, 24, 66, 15);
|
||||
panel.add(lblNewLabel);
|
||||
|
||||
textFieldsYear = new JTextField();
|
||||
textFieldsYear.setBounds(76, 21, 45, 21);
|
||||
panel.add(textFieldsYear);
|
||||
textFieldsYear.setColumns(10);
|
||||
|
||||
JLabel lblNewLabel_1 = new JLabel("Y");
|
||||
lblNewLabel_1.setBounds(128, 24, 24, 15);
|
||||
panel.add(lblNewLabel_1);
|
||||
|
||||
textFieldsMonth = new JTextField();
|
||||
textFieldsMonth.setColumns(10);
|
||||
textFieldsMonth.setBounds(148, 21, 45, 21);
|
||||
panel.add(textFieldsMonth);
|
||||
|
||||
JLabel lblMonth = new JLabel("M");
|
||||
lblMonth.setBounds(200, 24, 24, 15);
|
||||
panel.add(lblMonth);
|
||||
|
||||
textFieldsDay = new JTextField();
|
||||
textFieldsDay.setColumns(10);
|
||||
textFieldsDay.setBounds(222, 21, 45, 21);
|
||||
panel.add(textFieldsDay);
|
||||
|
||||
JLabel lblD = new JLabel("D");
|
||||
lblD.setBounds(271, 24, 24, 15);
|
||||
panel.add(lblD);
|
||||
|
||||
textFieldsHour = new JTextField();
|
||||
textFieldsHour.setColumns(10);
|
||||
textFieldsHour.setBounds(294, 21, 45, 21);
|
||||
panel.add(textFieldsHour);
|
||||
|
||||
JLabel lblH = new JLabel("H");
|
||||
lblH.setBounds(342, 24, 24, 15);
|
||||
panel.add(lblH);
|
||||
|
||||
textFieldsMinute = new JTextField();
|
||||
textFieldsMinute.setColumns(10);
|
||||
textFieldsMinute.setBounds(366, 21, 45, 21);
|
||||
panel.add(textFieldsMinute);
|
||||
|
||||
JLabel lblM = new JLabel("M");
|
||||
lblM.setBounds(418, 24, 24, 15);
|
||||
panel.add(lblM);
|
||||
|
||||
textFieldsSecond = new JTextField();
|
||||
textFieldsSecond.setColumns(10);
|
||||
textFieldsSecond.setBounds(440, 21, 45, 21);
|
||||
panel.add(textFieldsSecond);
|
||||
|
||||
JLabel lblS = new JLabel("S");
|
||||
lblS.setBounds(492, 24, 24, 15);
|
||||
panel.add(lblS);
|
||||
|
||||
JLabel lblStopTime = new JLabel("Stop Time");
|
||||
lblStopTime.setBounds(10, 66, 54, 15);
|
||||
panel.add(lblStopTime);
|
||||
|
||||
textFieldeYear = new JTextField();
|
||||
textFieldeYear.setColumns(10);
|
||||
textFieldeYear.setBounds(76, 63, 45, 21);
|
||||
panel.add(textFieldeYear);
|
||||
|
||||
JLabel lblY = new JLabel("Y");
|
||||
lblY.setBounds(128, 66, 24, 15);
|
||||
panel.add(lblY);
|
||||
|
||||
textFieldeMonth = new JTextField();
|
||||
textFieldeMonth.setColumns(10);
|
||||
textFieldeMonth.setBounds(148, 63, 45, 21);
|
||||
panel.add(textFieldeMonth);
|
||||
|
||||
JLabel lblM_1 = new JLabel("M");
|
||||
lblM_1.setBounds(200, 66, 24, 15);
|
||||
panel.add(lblM_1);
|
||||
|
||||
textFieldeDay = new JTextField();
|
||||
textFieldeDay.setColumns(10);
|
||||
textFieldeDay.setBounds(222, 63, 45, 21);
|
||||
panel.add(textFieldeDay);
|
||||
|
||||
JLabel lblD_1 = new JLabel("D");
|
||||
lblD_1.setBounds(271, 66, 24, 15);
|
||||
panel.add(lblD_1);
|
||||
|
||||
textFieldeHour = new JTextField();
|
||||
textFieldeHour.setColumns(10);
|
||||
textFieldeHour.setBounds(294, 63, 45, 21);
|
||||
panel.add(textFieldeHour);
|
||||
|
||||
JLabel lblH_1 = new JLabel("H");
|
||||
lblH_1.setBounds(342, 66, 24, 15);
|
||||
panel.add(lblH_1);
|
||||
|
||||
textFieldeMinute = new JTextField();
|
||||
textFieldeMinute.setColumns(10);
|
||||
textFieldeMinute.setBounds(366, 63, 45, 21);
|
||||
panel.add(textFieldeMinute);
|
||||
|
||||
JLabel lblM_2 = new JLabel("M");
|
||||
lblM_2.setBounds(418, 66, 24, 15);
|
||||
panel.add(lblM_2);
|
||||
|
||||
textFieldeSecond = new JTextField();
|
||||
textFieldeSecond.setColumns(10);
|
||||
textFieldeSecond.setBounds(440, 63, 45, 21);
|
||||
panel.add(textFieldeSecond);
|
||||
|
||||
JLabel lblS_1 = new JLabel("S");
|
||||
lblS_1.setBounds(492, 66, 24, 15);
|
||||
panel.add(lblS_1);
|
||||
|
||||
JLabel lblNewLabel_2 = new JLabel("Chan Num");
|
||||
lblNewLabel_2.setBounds(514, 24, 66, 15);
|
||||
panel.add(lblNewLabel_2);
|
||||
|
||||
textFieldChannelNum = new JTextField();
|
||||
textFieldChannelNum.setText("1");
|
||||
textFieldChannelNum.setBounds(577, 21, 66, 21);
|
||||
panel.add(textFieldChannelNum);
|
||||
textFieldChannelNum.setColumns(10);
|
||||
|
||||
JPanel panel_1 = new JPanel();
|
||||
panel_1.setBorder(new TitledBorder(null, "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
|
||||
panel_1.setBounds(10, 123, 663, 375);
|
||||
getContentPane().add(panel_1);
|
||||
panel_1.setLayout(null);
|
||||
|
||||
panelPlay = new Panel();
|
||||
panelPlay.setBackground(new Color(204, 255, 255));
|
||||
panelPlay.setBounds(10, 5, 643, 303);
|
||||
panel_1.add(panelPlay);
|
||||
|
||||
JToolBar toolBar = new JToolBar();
|
||||
toolBar.setBounds(117, 325, 401, 38);
|
||||
panel_1.add(toolBar);
|
||||
|
||||
JLabel lblNewLabel_8 = new JLabel(" ");
|
||||
toolBar.add(lblNewLabel_8);
|
||||
|
||||
btnNewButtonPlay = new JButton("Play");
|
||||
btnNewButtonPlay.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
PlayActionPerformed(e);
|
||||
}
|
||||
});
|
||||
btnNewButtonPlay.setBackground(new Color(204, 255, 255));
|
||||
toolBar.add(btnNewButtonPlay);
|
||||
|
||||
JLabel lblNewLabel_3 = new JLabel(" ");
|
||||
toolBar.add(lblNewLabel_3);
|
||||
|
||||
JButton btnNewButtonStop = new JButton("Stop");
|
||||
btnNewButtonStop.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
StopActionPerformed(e);
|
||||
}
|
||||
});
|
||||
btnNewButtonStop.setBackground(new Color(204, 255, 255));
|
||||
toolBar.add(btnNewButtonStop);
|
||||
|
||||
JLabel lblNewLabel_4 = new JLabel(" ");
|
||||
toolBar.add(lblNewLabel_4);
|
||||
|
||||
JButton btnNewButtonFast = new JButton("Quick");
|
||||
btnNewButtonFast.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
FastActionPerformed(e);
|
||||
}
|
||||
});
|
||||
btnNewButtonFast.setBackground(new Color(204, 255, 255));
|
||||
toolBar.add(btnNewButtonFast);
|
||||
|
||||
JLabel lblNewLabel_5 = new JLabel(" ");
|
||||
toolBar.add(lblNewLabel_5);
|
||||
|
||||
JButton btnNewButtonSlow = new JButton("Slow");
|
||||
btnNewButtonSlow.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
SlowActionPerformed(e);
|
||||
}
|
||||
});
|
||||
btnNewButtonSlow.setBackground(new Color(204, 255, 255));
|
||||
toolBar.add(btnNewButtonSlow);
|
||||
|
||||
JLabel lblNewLabel_6 = new JLabel(" ");
|
||||
toolBar.add(lblNewLabel_6);
|
||||
|
||||
JButton btnNewButtonCapture = new JButton("JPEG");
|
||||
btnNewButtonCapture.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
CaptureActionPerformed(e);
|
||||
}
|
||||
});
|
||||
btnNewButtonCapture.setBackground(new Color(204, 255, 255));
|
||||
toolBar.add(btnNewButtonCapture);
|
||||
|
||||
JLabel lblNewLabel_7 = new JLabel(" ");
|
||||
toolBar.add(lblNewLabel_7);
|
||||
|
||||
btnNewButtonAudio = new JButton("Volum");
|
||||
btnNewButtonAudio.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
AudioActionPerformed(e);
|
||||
}
|
||||
});
|
||||
btnNewButtonAudio.setBackground(new Color(204, 255, 255));
|
||||
toolBar.add(btnNewButtonAudio);
|
||||
|
||||
sliderAudio = new JSlider();
|
||||
sliderAudio.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent arg0) {
|
||||
SliderAudioMouseReleased(arg0);
|
||||
}
|
||||
});
|
||||
sliderAudio.setBounds(528, 333, 123, 15);
|
||||
panel_1.add(sliderAudio);
|
||||
|
||||
RadioForward = new JRadioButton("Forward");
|
||||
RadioForward.setSelected(true);
|
||||
RadioForward.setBounds(10, 325, 88, 23);
|
||||
panel_1.add(RadioForward);
|
||||
|
||||
RadioReverse = new JRadioButton("Reverse");
|
||||
RadioReverse.setBounds(10, 350, 94, 23);
|
||||
panel_1.add(RadioReverse);
|
||||
|
||||
ButtonGroup buttonGroup = new ButtonGroup();
|
||||
buttonGroup.add(RadioForward);
|
||||
buttonGroup.add(RadioReverse);
|
||||
|
||||
|
||||
|
||||
btnNewButtonDownload = new JButton("Download");
|
||||
btnNewButtonDownload.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
DownloadActionPerformed(e);
|
||||
}
|
||||
});
|
||||
btnNewButtonDownload.setBounds(63, 520, 91, 23);
|
||||
getContentPane().add(btnNewButtonDownload);
|
||||
|
||||
buttonSave = new JButton("Save");
|
||||
buttonSave.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
SaveActionPerformed(e);
|
||||
}
|
||||
});
|
||||
buttonSave.setBounds(277, 520, 77, 23);
|
||||
getContentPane().add(buttonSave);
|
||||
|
||||
buttonExit = new JButton("Exit");
|
||||
buttonExit.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ExitActionPerformed(e);
|
||||
}
|
||||
});
|
||||
buttonExit.setBounds(501, 520, 77, 23);
|
||||
getContentPane().add(buttonExit);
|
||||
}
|
||||
|
||||
|
||||
private void initialDialog()
|
||||
{
|
||||
Date today = new Date();
|
||||
Calendar now = Calendar.getInstance();
|
||||
now.setTime(today);
|
||||
|
||||
//start time
|
||||
textFieldsYear.setText(now.get(Calendar.YEAR) + "");
|
||||
textFieldsMonth.setText((now.get(Calendar.MONTH) + 1) + "");
|
||||
textFieldsDay.setText(1 + "");
|
||||
textFieldsHour.setText("0");
|
||||
textFieldsMinute.setText("0");
|
||||
textFieldsSecond.setText("0");
|
||||
|
||||
//endtime
|
||||
textFieldeYear.setText(now.get(Calendar.YEAR) + "");
|
||||
textFieldeMonth.setText((now.get(Calendar.MONTH) + 1) + "");
|
||||
textFieldeDay.setText(now.get(Calendar.DATE) + "");
|
||||
textFieldeHour.setText("23");
|
||||
textFieldeMinute.setText("59");
|
||||
textFieldeSecond.setText("59");
|
||||
|
||||
this.addWindowListener(new WindowAdapter()
|
||||
{
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e)
|
||||
{
|
||||
StopPlay();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//stop play
|
||||
private void StopPlay()
|
||||
{
|
||||
if (m_lPlayHandle.intValue() >= 0)
|
||||
{
|
||||
if (m_bTimeSave)
|
||||
{
|
||||
hCNetSDK.NET_DVR_StopPlayBackSave(m_lPlayHandle);
|
||||
buttonSave.setText("Save");
|
||||
m_bTimeSave = false;
|
||||
}
|
||||
|
||||
hCNetSDK.NET_DVR_PlayBackControl(m_lPlayHandle, HCNetSDK.NET_DVR_PLAYSTOPAUDIO, 0, null);
|
||||
hCNetSDK.NET_DVR_StopPlayBack(m_lPlayHandle);
|
||||
m_lPlayHandle.setValue(-1);
|
||||
|
||||
Playbacktimer.cancel();
|
||||
panelPlay.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
//play
|
||||
private void PlayActionPerformed(ActionEvent event)
|
||||
{
|
||||
HCNetSDK.NET_DVR_TIME struStartTime;
|
||||
HCNetSDK.NET_DVR_TIME struStopTime;
|
||||
|
||||
if (m_lPlayHandle.intValue() == -1)
|
||||
{
|
||||
m_iChanShowNum = Integer.parseInt(textFieldChannelNum.getText());
|
||||
|
||||
struStartTime = new HCNetSDK.NET_DVR_TIME();
|
||||
struStopTime = new HCNetSDK.NET_DVR_TIME();
|
||||
|
||||
struStartTime.dwYear = Integer.parseInt(textFieldsYear.getText());// 开始时间
|
||||
struStartTime.dwMonth = Integer.parseInt(textFieldsMonth.getText());
|
||||
struStartTime.dwDay = Integer.parseInt(textFieldsDay.getText());
|
||||
struStartTime.dwHour = Integer.parseInt(textFieldsHour.getText());
|
||||
struStartTime.dwMinute = Integer.parseInt(textFieldsMinute.getText());
|
||||
struStartTime.dwSecond = Integer.parseInt(textFieldsSecond.getText());
|
||||
struStopTime.dwYear = Integer.parseInt(textFieldeYear.getText());// 结束时间
|
||||
struStopTime.dwMonth = Integer.parseInt(textFieldeMonth.getText());
|
||||
struStopTime.dwDay = Integer.parseInt(textFieldeDay.getText());
|
||||
struStopTime.dwHour = Integer.parseInt(textFieldeHour.getText());
|
||||
struStopTime.dwMinute = Integer.parseInt(textFieldeMinute.getText());
|
||||
struStopTime.dwSecond = Integer.parseInt(textFieldeSecond.getText());
|
||||
|
||||
HWND hwnd = new HWND(Native.getComponentPointer(panelPlay));
|
||||
NET_DVR_VOD_PARA struVoidParam = new NET_DVR_VOD_PARA();
|
||||
struVoidParam.dwSize = struVoidParam.size();
|
||||
struVoidParam.struBeginTime = struStartTime;
|
||||
struVoidParam.struEndTime = struStopTime;
|
||||
struVoidParam.hWnd = hwnd;
|
||||
NET_DVR_STREAM_INFO struInfo = new NET_DVR_STREAM_INFO ();
|
||||
struInfo.dwSize = struInfo.size();
|
||||
struInfo.dwChannel = m_iChanShowNum;
|
||||
struVoidParam.struIDInfo = struInfo;
|
||||
if(RadioForward.isSelected())
|
||||
{
|
||||
m_lPlayHandle = hCNetSDK.NET_DVR_PlayBackByTime_V40(m_lUserID, struVoidParam);
|
||||
}
|
||||
else
|
||||
{
|
||||
NET_DVR_PLAYCOND struPlayCond = new NET_DVR_PLAYCOND();
|
||||
struPlayCond.dwChannel = m_iChanShowNum;
|
||||
struPlayCond.struStartTime = struStartTime;
|
||||
struPlayCond.struStopTime = struStopTime;
|
||||
m_lPlayHandle = hCNetSDK.NET_DVR_PlayBackReverseByTime_V40(m_lUserID,hwnd,struPlayCond);
|
||||
}
|
||||
|
||||
if (m_lPlayHandle.intValue() == -1)
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("Plackback by time fail,error code:" + hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
hCNetSDK.NET_DVR_PlayBackControl(m_lPlayHandle, HCNetSDK.NET_DVR_PLAYSTART, 0, null);
|
||||
}
|
||||
|
||||
if (hCNetSDK.NET_DVR_PlayBackControl(m_lPlayHandle, HCNetSDK.NET_DVR_PLAYSTARTAUDIO, 0, null))
|
||||
{
|
||||
m_bSound = true;
|
||||
hCNetSDK.NET_DVR_PlayBackControl(m_lPlayHandle, HCNetSDK.NET_DVR_PLAYAUDIOVOLUME, (0xffff) / 2, null);
|
||||
sliderAudio.setValue(50);
|
||||
btnNewButtonAudio.setText("Volum");
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bSound = false;
|
||||
btnNewButtonAudio.setText("no volum");
|
||||
}
|
||||
|
||||
|
||||
Playbacktimer = new Timer();
|
||||
Playbacktimer.schedule(new PlaybackTask(), 0, 5000);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_bPause)
|
||||
{
|
||||
if (hCNetSDK.NET_DVR_PlayBackControl(m_lPlayHandle, HCNetSDK.NET_DVR_PLAYRESTART, 0, null))
|
||||
{
|
||||
btnNewButtonPlay.setText("Pause");
|
||||
m_bPause = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hCNetSDK.NET_DVR_PlayBackControl(m_lPlayHandle, HCNetSDK.NET_DVR_PLAYPAUSE, 0, null))
|
||||
{
|
||||
m_bPause = true;
|
||||
btnNewButtonPlay.setText("Start");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//StopPlay
|
||||
private void StopActionPerformed(ActionEvent event)
|
||||
{
|
||||
StopPlay();
|
||||
}
|
||||
|
||||
//quick
|
||||
@SuppressWarnings("static-access")
|
||||
private void FastActionPerformed(ActionEvent event)
|
||||
{
|
||||
hCNetSDK.NET_DVR_PlayBackControl(m_lPlayHandle, hCNetSDK.NET_DVR_PLAYFAST, 0, null);
|
||||
}
|
||||
|
||||
//slow
|
||||
@SuppressWarnings("static-access")
|
||||
private void SlowActionPerformed(ActionEvent event)
|
||||
{
|
||||
hCNetSDK.NET_DVR_PlayBackControl(m_lPlayHandle, hCNetSDK.NET_DVR_PLAYSLOW, 0, null);
|
||||
}
|
||||
|
||||
//jpeg
|
||||
private void CaptureActionPerformed(ActionEvent event)
|
||||
{
|
||||
if (m_lPlayHandle.intValue() == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
String sPicName = "C:/Picture/" + m_iChanShowNum + System.currentTimeMillis() + ".bmp";
|
||||
if (hCNetSDK.NET_DVR_PlayBackCaptureFile(m_lPlayHandle, sPicName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("JPEG fail,error code:" + hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
//audio
|
||||
private void AudioActionPerformed(ActionEvent event)
|
||||
{
|
||||
if (m_lPlayHandle.intValue() >= 0)
|
||||
{
|
||||
if (m_bSound)
|
||||
{
|
||||
if (hCNetSDK.NET_DVR_PlayBackControl(m_lPlayHandle, HCNetSDK.NET_DVR_PLAYSTOPAUDIO, 0, null))
|
||||
{
|
||||
m_bSound = false;
|
||||
btnNewButtonAudio.setText("no volum");
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Stop audio failed!");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hCNetSDK.NET_DVR_PlayBackControl(m_lPlayHandle, HCNetSDK.NET_DVR_PLAYSTARTAUDIO, 0, null))
|
||||
{
|
||||
btnNewButtonAudio.setText("Volum");
|
||||
m_bSound = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Start audio failed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//SliderAudio
|
||||
private void SliderAudioMouseReleased(MouseEvent event)
|
||||
{
|
||||
if (m_lPlayHandle.intValue() >= 0)
|
||||
{
|
||||
if (hCNetSDK.NET_DVR_PlayBackControl(m_lPlayHandle, HCNetSDK.NET_DVR_PLAYAUDIOVOLUME,
|
||||
sliderAudio.getValue(), null))
|
||||
{
|
||||
System.out.println(" Set volume Succeed!");
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println(" Set volume Failed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//download
|
||||
private void DownloadActionPerformed(ActionEvent event)
|
||||
{
|
||||
if (m_lLoadHandle.intValue() == -1)
|
||||
{
|
||||
HCNetSDK.NET_DVR_TIME struStartTime;
|
||||
HCNetSDK.NET_DVR_TIME struStopTime;
|
||||
|
||||
struStartTime = new HCNetSDK.NET_DVR_TIME();
|
||||
struStopTime = new HCNetSDK.NET_DVR_TIME();
|
||||
struStartTime.dwYear = Integer.parseInt(textFieldsYear.getText());
|
||||
struStartTime.dwMonth = Integer.parseInt(textFieldsMonth.getText());
|
||||
struStartTime.dwDay = Integer.parseInt(textFieldsDay.getText());
|
||||
struStartTime.dwHour = Integer.parseInt(textFieldsHour.getText());
|
||||
struStartTime.dwMinute = Integer.parseInt(textFieldsMinute.getText());
|
||||
struStartTime.dwSecond = Integer.parseInt(textFieldsSecond.getText());
|
||||
struStopTime.dwYear = Integer.parseInt(textFieldeYear.getText());
|
||||
struStopTime.dwMonth = Integer.parseInt(textFieldeMonth.getText());
|
||||
struStopTime.dwDay = Integer.parseInt(textFieldeDay.getText());
|
||||
struStopTime.dwHour = Integer.parseInt(textFieldeHour.getText());
|
||||
struStopTime.dwMinute = Integer.parseInt(textFieldeMinute.getText());
|
||||
struStopTime.dwSecond = Integer.parseInt(textFieldeSecond.getText());
|
||||
|
||||
m_iChanShowNum = Integer.parseInt(textFieldChannelNum.getText());
|
||||
|
||||
String sFileName = "c:/DownLoad/" + m_sDeviceIP + m_iChanShowNum + struStartTime.toStringTitle() + struStopTime.toStringTitle() + ".mp4";
|
||||
System.out.println(sFileName);
|
||||
|
||||
NET_DVR_PLAYCOND struDownloadCond = new NET_DVR_PLAYCOND();
|
||||
struDownloadCond.dwChannel = m_iChanShowNum;
|
||||
struDownloadCond.struStartTime = struStartTime;
|
||||
struDownloadCond.struStopTime = struStopTime;
|
||||
m_lLoadHandle = hCNetSDK.NET_DVR_GetFileByTime_V40(m_lUserID,sFileName,struDownloadCond);
|
||||
if (m_lLoadHandle.intValue() >= 0)
|
||||
{
|
||||
hCNetSDK.NET_DVR_PlayBackControl(m_lLoadHandle, HCNetSDK.NET_DVR_PLAYSTART, 0, null);
|
||||
btnNewButtonDownload.setText("Stop Download");
|
||||
Downloadtimer = new Timer();
|
||||
Downloadtimer.schedule(new DownloadTask(), 0, 5000);
|
||||
} else
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("Download byTime fail,error code:" + hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
System.out.println("laste error " + hCNetSDK.NET_DVR_GetLastError());
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
hCNetSDK.NET_DVR_StopGetFile(m_lLoadHandle);
|
||||
btnNewButtonDownload.setText("Download");
|
||||
Downloadtimer.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
//save
|
||||
private void SaveActionPerformed(ActionEvent event)
|
||||
{
|
||||
if (m_lPlayHandle.intValue() == -1)
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("Please play file" );
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
if (!m_bTimeSave)
|
||||
{
|
||||
JFileChooser myJFileChooser = new JFileChooser();
|
||||
myJFileChooser.showSaveDialog(this);
|
||||
String sFileName = myJFileChooser.getSelectedFile() + ".mp4";
|
||||
if (hCNetSDK.NET_DVR_PlayBackSaveData(m_lPlayHandle, sFileName))
|
||||
{
|
||||
m_bTimeSave = true;
|
||||
buttonSave.setText("Stop Save");
|
||||
}
|
||||
} else
|
||||
{
|
||||
hCNetSDK.NET_DVR_StopPlayBackSave(m_lPlayHandle);
|
||||
m_bTimeSave = false;
|
||||
buttonSave.setText("Save");
|
||||
}
|
||||
}
|
||||
|
||||
//exit
|
||||
private void ExitActionPerformed(ActionEvent event)
|
||||
{
|
||||
StopPlay();
|
||||
dispose();
|
||||
}
|
||||
|
||||
|
||||
class PlaybackTask extends java.util.TimerTask
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
IntByReference nPos = new IntByReference(0);
|
||||
if (m_lPlayHandle.intValue() >= 0)
|
||||
{
|
||||
if (hCNetSDK.NET_DVR_PlayBackControl(m_lPlayHandle, HCNetSDK.NET_DVR_PLAYGETPOS, 0, nPos))
|
||||
{
|
||||
System.out.println("回放进度" + nPos.getValue());
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("获取回放进度失败,错误码为:"+hCNetSDK.NET_DVR_GetLastError());
|
||||
}
|
||||
|
||||
if (nPos.getValue() > 100)
|
||||
{
|
||||
StopPlay();
|
||||
|
||||
DialogMessage dlg = new DialogMessage("NetWork or DVR busing,playBack exception stop");
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
if (nPos.getValue() == 100)
|
||||
{
|
||||
StopPlay();
|
||||
|
||||
DialogMessage dlg = new DialogMessage("PlayBack by time end");
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class DownloadTask extends java.util.TimerTask
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
IntByReference nPos = new IntByReference(0);
|
||||
hCNetSDK.NET_DVR_PlayBackControl(m_lLoadHandle, HCNetSDK.NET_DVR_PLAYGETPOS, 0, nPos);
|
||||
if (nPos.getValue() > 100)
|
||||
{
|
||||
hCNetSDK.NET_DVR_StopGetFile(m_lLoadHandle);
|
||||
m_lLoadHandle.setValue(-1);
|
||||
btnNewButtonDownload.setText("Save");
|
||||
Downloadtimer.cancel();
|
||||
|
||||
DialogMessage dlg = new DialogMessage("NetWork or DVR busing,download exception stop");
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
if (nPos.getValue() == 100)
|
||||
{
|
||||
hCNetSDK.NET_DVR_StopGetFile(m_lLoadHandle);
|
||||
m_lLoadHandle.setValue(-1);
|
||||
btnNewButtonDownload.setText("Download");
|
||||
Downloadtimer.cancel();
|
||||
|
||||
DialogMessage dlg = new DialogMessage("Download by time end");
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package test;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
|
||||
import com.sun.jna.NativeLong;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import java.awt.Font;
|
||||
import java.awt.Color;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
public class DialogReboot extends JDialog
|
||||
{
|
||||
|
||||
private final JPanel contentPanel = new JPanel();
|
||||
static HCNetSDK hCNetSDK = HCNetSDK.INSTANCE;
|
||||
private NativeLong m_lUserID;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create the dialog.
|
||||
*/
|
||||
public DialogReboot( NativeLong lUserId)
|
||||
{
|
||||
InitComponent();
|
||||
m_lUserID = lUserId;
|
||||
|
||||
}
|
||||
|
||||
public void InitComponent()
|
||||
{
|
||||
setBounds(100, 100, 414, 235);
|
||||
getContentPane().setLayout(new BorderLayout());
|
||||
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
getContentPane().add(contentPanel, BorderLayout.CENTER);
|
||||
contentPanel.setLayout(null);
|
||||
{
|
||||
JLabel lblNewLabel = new JLabel("Are you sure to reboot?");
|
||||
lblNewLabel.setBounds(145, 36, 189, 43);
|
||||
contentPanel.add(lblNewLabel);
|
||||
}
|
||||
|
||||
JLabel lblNewLabel_1 = new JLabel("?");
|
||||
lblNewLabel_1.setForeground(Color.RED);
|
||||
lblNewLabel_1.setBackground(Color.RED);
|
||||
lblNewLabel_1.setFont(new Font("宋体", Font.PLAIN, 20));
|
||||
lblNewLabel_1.setBounds(111, 34, 24, 43);
|
||||
contentPanel.add(lblNewLabel_1);
|
||||
{
|
||||
JButton okButton = new JButton("OK");
|
||||
okButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
RebootActionPerformed(e);
|
||||
}
|
||||
});
|
||||
okButton.setBounds(111, 114, 57, 23);
|
||||
contentPanel.add(okButton);
|
||||
okButton.setActionCommand("OK");
|
||||
getRootPane().setDefaultButton(okButton);
|
||||
}
|
||||
{
|
||||
JButton cancelButton = new JButton("Cancel");
|
||||
cancelButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ExitActionPerformed(e);
|
||||
}
|
||||
});
|
||||
cancelButton.setBounds(220, 114, 69, 23);
|
||||
contentPanel.add(cancelButton);
|
||||
cancelButton.setActionCommand("Cancel");
|
||||
}
|
||||
{
|
||||
JPanel buttonPane = new JPanel();
|
||||
buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
|
||||
getContentPane().add(buttonPane, BorderLayout.SOUTH);
|
||||
}
|
||||
}
|
||||
|
||||
public void RebootActionPerformed(ActionEvent event)
|
||||
{
|
||||
if (!hCNetSDK.NET_DVR_RebootDVR(m_lUserID))
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("Reboot fail,error code="+ hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(this.getX()+this.getWidth()/3,this.getY()+this.getHeight()/3 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void ExitActionPerformed(ActionEvent event)
|
||||
{
|
||||
this.dispose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,414 @@
|
||||
package test;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JFileChooser;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
|
||||
import com.sun.jna.NativeLong;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
|
||||
import test.HCNetSDK.ENUM_UPGRADE_TYPE;
|
||||
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JProgressBar;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
public class DialogUpGrade extends JDialog
|
||||
{
|
||||
|
||||
private final JPanel contentPanel = new JPanel();
|
||||
private JTextField textFieldFilePath;
|
||||
static HCNetSDK hCNetSDK = HCNetSDK.INSTANCE;
|
||||
private JComboBox comboBoxNetEnv;
|
||||
private JComboBox comboBoxUpGradeType;
|
||||
private JComboBox comboBoxChan;
|
||||
private JLabel labelChan;
|
||||
private JComboBox comboBoxAuxDev;
|
||||
private JProgressBar progressBar;
|
||||
private JLabel labelStatus;
|
||||
|
||||
NativeLong m_lUserID;
|
||||
int m_iChanNum;
|
||||
Timer time;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create the dialog.
|
||||
*/
|
||||
public DialogUpGrade(NativeLong lUserID,int iChanNum)
|
||||
{
|
||||
super();
|
||||
setTitle("Remote Upgrade");
|
||||
InitComponent();
|
||||
m_lUserID = lUserID;
|
||||
m_iChanNum = iChanNum;
|
||||
progressBar.setMinimum(0);
|
||||
progressBar.setMaximum(100);
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
public void InitComponent()
|
||||
{
|
||||
setBounds(100, 100, 573, 326);
|
||||
getContentPane().setLayout(new BorderLayout());
|
||||
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
getContentPane().add(contentPanel, BorderLayout.CENTER);
|
||||
contentPanel.setLayout(null);
|
||||
{
|
||||
JLabel lblNewLabel = new JLabel("Network Type");
|
||||
lblNewLabel.setBounds(10, 20, 83, 15);
|
||||
contentPanel.add(lblNewLabel);
|
||||
}
|
||||
{
|
||||
comboBoxNetEnv = new JComboBox();
|
||||
comboBoxNetEnv.setModel(new DefaultComboBoxModel(new String[] {"LAN"}));
|
||||
comboBoxNetEnv.setBounds(92, 17, 96, 21);
|
||||
contentPanel.add(comboBoxNetEnv);
|
||||
}
|
||||
{
|
||||
JButton btnNewButton = new JButton("Set NetWork Type");
|
||||
btnNewButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
SetNetEnvironment(e);
|
||||
}
|
||||
});
|
||||
btnNewButton.setBounds(380, 16, 149, 23);
|
||||
contentPanel.add(btnNewButton);
|
||||
}
|
||||
{
|
||||
JLabel lblNewLabel_1 = new JLabel("Upgrade Type");
|
||||
lblNewLabel_1.setBounds(10, 63, 72, 15);
|
||||
contentPanel.add(lblNewLabel_1);
|
||||
}
|
||||
{
|
||||
comboBoxUpGradeType = new JComboBox();
|
||||
comboBoxUpGradeType.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
SelectedChangeActionPerformed(e);
|
||||
}
|
||||
});
|
||||
comboBoxUpGradeType.setModel(new DefaultComboBoxModel(new String[] {"DVR", "Adapter", "Vcalib", "ACS", "IDS", "LED"}));
|
||||
comboBoxUpGradeType.setBounds(92, 60, 96, 21);
|
||||
contentPanel.add(comboBoxUpGradeType);
|
||||
}
|
||||
{
|
||||
JLabel lblAuxDev = new JLabel("Aux Dev");
|
||||
lblAuxDev.setBounds(366, 63, 54, 15);
|
||||
contentPanel.add(lblAuxDev);
|
||||
}
|
||||
{
|
||||
comboBoxAuxDev = new JComboBox();
|
||||
comboBoxAuxDev.setModel(new DefaultComboBoxModel(new String[] {"Keyboard", "Movement"}));
|
||||
comboBoxAuxDev.setBounds(430, 60, 96, 21);
|
||||
contentPanel.add(comboBoxAuxDev);
|
||||
}
|
||||
{
|
||||
JLabel lblNewLabel_2 = new JLabel("File");
|
||||
lblNewLabel_2.setBounds(10, 108, 54, 15);
|
||||
contentPanel.add(lblNewLabel_2);
|
||||
}
|
||||
{
|
||||
textFieldFilePath = new JTextField();
|
||||
textFieldFilePath.setText("c:\\digicap");
|
||||
textFieldFilePath.setBounds(74, 105, 357, 21);
|
||||
contentPanel.add(textFieldFilePath);
|
||||
textFieldFilePath.setColumns(10);
|
||||
}
|
||||
{
|
||||
JButton btnNewButton_1 = new JButton("Scan");
|
||||
btnNewButton_1.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ScanActionPerformed(e);
|
||||
}
|
||||
});
|
||||
btnNewButton_1.setBounds(456, 104, 70, 23);
|
||||
contentPanel.add(btnNewButton_1);
|
||||
}
|
||||
|
||||
progressBar = new JProgressBar();
|
||||
progressBar.setBounds(10, 204, 519, 14);
|
||||
contentPanel.add(progressBar);
|
||||
|
||||
JButton btnNewButton_3 = new JButton("Upgrade");
|
||||
btnNewButton_3.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
UpGradeActionPerformed(e);
|
||||
}
|
||||
});
|
||||
btnNewButton_3.setBounds(45, 247, 93, 23);
|
||||
contentPanel.add(btnNewButton_3);
|
||||
|
||||
JButton btnNewButton_4 = new JButton("Exit");
|
||||
btnNewButton_4.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ExitActionPerformed(e);
|
||||
}
|
||||
});
|
||||
btnNewButton_4.setBounds(311, 247, 93, 23);
|
||||
contentPanel.add(btnNewButton_4);
|
||||
{
|
||||
labelStatus = new JLabel("State");
|
||||
labelStatus.setBounds(10, 169, 54, 15);
|
||||
contentPanel.add(labelStatus);
|
||||
}
|
||||
|
||||
labelChan = new JLabel("Type");
|
||||
labelChan.setVisible(false);
|
||||
labelChan.setBounds(201, 63, 31, 15);
|
||||
contentPanel.add(labelChan);
|
||||
|
||||
comboBoxChan = new JComboBox();
|
||||
comboBoxChan.setVisible(false);
|
||||
comboBoxChan.setBounds(229, 60, 107, 21);
|
||||
contentPanel.add(comboBoxChan);
|
||||
}
|
||||
|
||||
//set net work environment
|
||||
public void SetNetEnvironment(ActionEvent event)
|
||||
{
|
||||
int iEnvLevel = comboBoxNetEnv.getSelectedIndex();
|
||||
if (!hCNetSDK.NET_DVR_SetNetworkEnvironment(iEnvLevel))
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("set net environment failed,error code:"+hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//scan file
|
||||
public void ScanActionPerformed(ActionEvent event)
|
||||
{
|
||||
JFileChooser jFileChooser = new JFileChooser("c:/digicap");
|
||||
if(JFileChooser.APPROVE_OPTION == jFileChooser.showOpenDialog(this))
|
||||
{
|
||||
openFile(jFileChooser.getSelectedFile().getPath());
|
||||
String filePath = jFileChooser.getSelectedFile().getPath();
|
||||
textFieldFilePath.setText(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
void openFile(String fileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
File file = new File(fileName);
|
||||
int size = (int) file.length();
|
||||
int chars_read = 0;
|
||||
FileReader in = new FileReader(file);
|
||||
char[] data = new char[size];
|
||||
while (in.ready())
|
||||
{
|
||||
chars_read += in.read(data, chars_read, size - chars_read);
|
||||
|
||||
}
|
||||
in.close();
|
||||
} catch (IOException e)
|
||||
{
|
||||
System.out.println(e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
//exit
|
||||
public void ExitActionPerformed(ActionEvent event)
|
||||
{
|
||||
this.dispose();
|
||||
}
|
||||
|
||||
// upgrade
|
||||
public void UpGradeActionPerformed(ActionEvent event) {
|
||||
NativeLong lUpgradeHandle = new NativeLong(-1);
|
||||
File fileUpgrade = new File(textFieldFilePath.getText());
|
||||
if (!fileUpgrade.canRead()) {
|
||||
DialogMessage dlg = new DialogMessage("error file");
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
JOptionPane.showMessageDialog(this, "无效文件");
|
||||
return;
|
||||
}
|
||||
if (fileUpgrade.length() == 0) {
|
||||
DialogMessage dlg = new DialogMessage("file is null");
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
int iType = comboBoxUpGradeType.getSelectedIndex();
|
||||
switch (iType) {
|
||||
case 0:// DVR
|
||||
lUpgradeHandle = hCNetSDK.NET_DVR_Upgrade(m_lUserID, textFieldFilePath.getText());
|
||||
break;
|
||||
case 1: // adapter
|
||||
lUpgradeHandle = hCNetSDK.NET_DVR_AdapterUpgrade(m_lUserID, textFieldFilePath.getText());
|
||||
break;
|
||||
case 2: // vca lib
|
||||
int iChannel = comboBoxChan.getSelectedIndex() + 1;
|
||||
lUpgradeHandle = hCNetSDK.NET_DVR_VcalibUpgrade(m_lUserID, new NativeLong(iChannel),
|
||||
textFieldFilePath.getText());
|
||||
break;
|
||||
case 3:
|
||||
int iDevNo = comboBoxChan.getSelectedIndex();
|
||||
IntByReference intRef = new IntByReference(iDevNo);
|
||||
Pointer lpPointer = intRef.getPointer();
|
||||
lUpgradeHandle = hCNetSDK.NET_DVR_Upgrade_V40(m_lUserID, ENUM_UPGRADE_TYPE.ENUM_UPGRADE_ACS,
|
||||
textFieldFilePath.getText(), lpPointer, 4);
|
||||
break;
|
||||
case 4:
|
||||
HCNetSDK.NET_DVR_AUXILIARY_DEV_UPGRADE_PARAM struAuxDevParam = new HCNetSDK.NET_DVR_AUXILIARY_DEV_UPGRADE_PARAM();
|
||||
struAuxDevParam.dwSize = struAuxDevParam.size();
|
||||
// struAuxiliaryDevUpgradeParam.byDevType = 0;
|
||||
struAuxDevParam.byDevType = (byte) comboBoxAuxDev.getSelectedIndex();
|
||||
struAuxDevParam.dwDevNo = comboBoxChan.getSelectedIndex();
|
||||
struAuxDevParam.write();
|
||||
Pointer lpAuxDevParam = struAuxDevParam.getPointer();
|
||||
lUpgradeHandle = hCNetSDK.NET_DVR_Upgrade_V40(m_lUserID, ENUM_UPGRADE_TYPE.ENUM_UPGRADE_AUXILIARY_DEV,
|
||||
textFieldFilePath.getText(), lpAuxDevParam, struAuxDevParam.size());
|
||||
struAuxDevParam.read();
|
||||
break;
|
||||
case 5:
|
||||
int iCardType = comboBoxChan.getSelectedIndex() + 1;
|
||||
IntByReference intRefe = new IntByReference(iCardType);
|
||||
Pointer lpPoint = intRefe.getPointer();
|
||||
lUpgradeHandle = hCNetSDK.NET_DVR_Upgrade_V40(m_lUserID, ENUM_UPGRADE_TYPE.ENUM_UPGRADE_LED,
|
||||
textFieldFilePath.getText(), lpPoint, 4);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(lUpgradeHandle.intValue() < 0)
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("Upgrade failed,error code:"+hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
time = new Timer();
|
||||
time.schedule(new StatusTask(lUpgradeHandle), 0, 500);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void SelectedChangeActionPerformed(ActionEvent event)
|
||||
{
|
||||
int iUpgradeType = comboBoxUpGradeType.getSelectedIndex();
|
||||
switch(iUpgradeType)
|
||||
{
|
||||
case 2:
|
||||
labelChan.setVisible(true);
|
||||
comboBoxChan.setVisible(true);
|
||||
comboBoxChan.removeAllItems();
|
||||
for(int i=0;i< m_iChanNum;i++)
|
||||
{
|
||||
comboBoxChan.addItem("Chan "+(i+1));
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
labelChan.setVisible(true);
|
||||
labelChan.setText("Dev");
|
||||
comboBoxChan.setVisible(true);
|
||||
comboBoxChan.removeAllItems();
|
||||
for(int i=0;i<9;i++)
|
||||
{
|
||||
comboBoxChan.addItem("Dev "+i);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
labelChan.setVisible(true);
|
||||
labelChan.setText("Dev");
|
||||
comboBoxChan.setVisible(true);
|
||||
comboBoxChan.removeAllItems();
|
||||
for(int i=0;i<32;i++)
|
||||
{
|
||||
comboBoxChan.addItem("Dev "+i);
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
labelChan.setVisible(true);
|
||||
labelChan.setText("Type");
|
||||
comboBoxChan.setVisible(true);
|
||||
comboBoxChan.removeAllItems();
|
||||
comboBoxChan.addItem("Send Card");
|
||||
comboBoxChan.addItem("Rev Card");
|
||||
break;
|
||||
default:
|
||||
labelChan.setVisible(false);
|
||||
comboBoxChan.setVisible(false);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class StatusTask extends TimerTask
|
||||
{
|
||||
private NativeLong m_lUpgradeHandle;
|
||||
public StatusTask(NativeLong lUpgradeHandle) {
|
||||
// TODO Auto-generated constructor stub
|
||||
m_lUpgradeHandle = lUpgradeHandle;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
// TODO Auto-generated method stub
|
||||
int iUpgradeStatus = hCNetSDK.NET_DVR_GetUpgradeState(m_lUpgradeHandle);
|
||||
int iPos = hCNetSDK.NET_DVR_GetUpgradeProgress(m_lUpgradeHandle);
|
||||
|
||||
if(iPos > 0)
|
||||
{
|
||||
progressBar.setValue(iPos);
|
||||
}
|
||||
if(iUpgradeStatus == 2)
|
||||
{
|
||||
labelStatus.setText("status:upgrading ,please wait.....");
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (iUpgradeStatus)
|
||||
{
|
||||
case -1:
|
||||
labelStatus.setText("upgrade fail!");
|
||||
break;
|
||||
case 1:
|
||||
labelStatus.setText("status:upgrade success!");
|
||||
progressBar.setValue(100);
|
||||
break;
|
||||
case 3:
|
||||
labelStatus.setText("status:upgrade fail");
|
||||
break;
|
||||
case 4:
|
||||
labelStatus.setText("status:network disconnect,status unknow");
|
||||
break;
|
||||
case 5:
|
||||
labelStatus.setText("status:Upgrade file language mismatch");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if(!hCNetSDK.NET_DVR_CloseUpgradeHandle(m_lUpgradeHandle))
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("NET_DVR_CloseUpgradeHandle failed,error code:"+hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
m_lUpgradeHandle=new NativeLong(-1);
|
||||
time.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,414 @@
|
||||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
/*
|
||||
* JDialogVoiceTalk.java
|
||||
*
|
||||
* Created on 2009-11-30, 20:42:14
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
|
||||
package test;
|
||||
|
||||
import com.sun.jna.NativeLong;
|
||||
import com.sun.jna.Pointer;
|
||||
import java.io.*;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import javax.swing.GroupLayout;
|
||||
import javax.swing.LayoutStyle.ComponentPlacement;
|
||||
|
||||
public class DialogVoiceTalk extends javax.swing.JDialog
|
||||
{
|
||||
|
||||
static HCNetSDK hCNetSDK = HCNetSDK.INSTANCE;
|
||||
NativeLong m_lUserID;
|
||||
HCNetSDK.NET_DVR_DEVICEINFO_V30 m_strDeviceInfo;
|
||||
HCNetSDK.NET_DVR_WORKSTATE_V30 m_strWorkState;
|
||||
FVoiceDataCallBack fVoiceDataCallBack;
|
||||
int m_iSel;
|
||||
boolean m_bInitialed;
|
||||
|
||||
FileWriter fLocal;
|
||||
FileWriter fDevice;
|
||||
|
||||
public DialogVoiceTalk(java.awt.Frame parent, boolean modal, NativeLong lUserID,
|
||||
HCNetSDK.NET_DVR_DEVICEINFO_V30 strDeviceInfo)
|
||||
{
|
||||
super(parent, modal);
|
||||
try
|
||||
{
|
||||
initComponents();
|
||||
m_lUserID = lUserID;
|
||||
m_strDeviceInfo = strDeviceInfo;
|
||||
m_iSel = 0;
|
||||
fVoiceDataCallBack = new FVoiceDataCallBack();
|
||||
fLocal = new FileWriter("D:\\local.264");
|
||||
fDevice = new FileWriter("D:\\device.264");
|
||||
|
||||
initialDialog();
|
||||
m_bInitialed = true;
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.getLogger(DialogVoiceTalk.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
setModal(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is called from within the constructor to initialize the form.
|
||||
* WARNING: Do NOT modify this code. The content of this method is always
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated
|
||||
// Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents()
|
||||
{
|
||||
|
||||
jPanel = new javax.swing.JPanel();
|
||||
jLabel1 = new javax.swing.JLabel();
|
||||
jComboBoxVoiceChannel = new javax.swing.JComboBox();
|
||||
jComboBoxVoiceChannel.setModel(new DefaultComboBoxModel(new String[] { "Audio1" }));
|
||||
jLabelStatus = new javax.swing.JLabel();
|
||||
jButtonStart = new javax.swing.JButton();
|
||||
jButtonStop = new javax.swing.JButton();
|
||||
jLabel2 = new javax.swing.JLabel();
|
||||
jComboBoxDataType = new javax.swing.JComboBox();
|
||||
jButtonRefresh = new javax.swing.JButton();
|
||||
jButtonExit = new javax.swing.JButton();
|
||||
|
||||
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
|
||||
setTitle("VoiceTalk");
|
||||
|
||||
jPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
|
||||
|
||||
jLabel1.setText("Talk Chan");
|
||||
|
||||
jComboBoxVoiceChannel.addActionListener(new java.awt.event.ActionListener()
|
||||
{
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt)
|
||||
{
|
||||
jComboBoxVoiceChannelActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabelStatus.setText("not used");
|
||||
|
||||
jButtonStart.setText("Start");
|
||||
jButtonStart.addActionListener(new java.awt.event.ActionListener()
|
||||
{
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt)
|
||||
{
|
||||
jButtonStartActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jButtonStop.setText("Stop");
|
||||
jButtonStop.addActionListener(new java.awt.event.ActionListener()
|
||||
{
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt)
|
||||
{
|
||||
jButtonStopActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jLabel2.setText("CallBack Data Type");
|
||||
|
||||
jComboBoxDataType.setModel(new DefaultComboBoxModel(new String[] { "DisPCM", "PCM" }));
|
||||
|
||||
javax.swing.GroupLayout jPanelLayout = new javax.swing.GroupLayout(jPanel);
|
||||
jPanelLayout.setHorizontalGroup(jPanelLayout.createParallelGroup(Alignment.LEADING).addGroup(jPanelLayout
|
||||
.createSequentialGroup()
|
||||
.addGroup(jPanelLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(jPanelLayout.createSequentialGroup().addGap(18)
|
||||
.addGroup(jPanelLayout.createParallelGroup(Alignment.LEADING)
|
||||
.addGroup(jPanelLayout.createSequentialGroup().addComponent(jButtonStart)
|
||||
.addGap(36).addComponent(jButtonStop))
|
||||
.addGroup(jPanelLayout.createSequentialGroup().addComponent(jLabel1).addGap(18)
|
||||
.addComponent(jComboBoxVoiceChannel, GroupLayout.PREFERRED_SIZE, 82,
|
||||
GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(28).addComponent(jLabelStatus))))
|
||||
.addGroup(jPanelLayout.createSequentialGroup().addGap(86).addComponent(jLabel2)
|
||||
.addPreferredGap(ComponentPlacement.UNRELATED).addComponent(jComboBoxDataType,
|
||||
GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
|
||||
GroupLayout.PREFERRED_SIZE)))
|
||||
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
|
||||
jPanelLayout.setVerticalGroup(jPanelLayout.createParallelGroup(Alignment.LEADING).addGroup(jPanelLayout
|
||||
.createSequentialGroup().addContainerGap()
|
||||
.addGroup(jPanelLayout.createParallelGroup(Alignment.BASELINE).addComponent(jLabel1)
|
||||
.addComponent(jComboBoxVoiceChannel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
|
||||
GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(jLabelStatus))
|
||||
.addGap(18)
|
||||
.addGroup(jPanelLayout.createParallelGroup(Alignment.BASELINE).addComponent(jButtonStart)
|
||||
.addComponent(jButtonStop))
|
||||
.addGap(18)
|
||||
.addGroup(jPanelLayout.createParallelGroup(Alignment.BASELINE).addComponent(jLabel2).addComponent(
|
||||
jComboBoxDataType, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
|
||||
GroupLayout.PREFERRED_SIZE))
|
||||
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
|
||||
jPanel.setLayout(jPanelLayout);
|
||||
|
||||
jButtonRefresh.setText("Refresh");
|
||||
jButtonRefresh.addActionListener(new java.awt.event.ActionListener()
|
||||
{
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt)
|
||||
{
|
||||
jButtonRefreshActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
jButtonExit.setText("Exit");
|
||||
jButtonExit.addActionListener(new java.awt.event.ActionListener()
|
||||
{
|
||||
public void actionPerformed(java.awt.event.ActionEvent evt)
|
||||
{
|
||||
jButtonExitActionPerformed(evt);
|
||||
}
|
||||
});
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
|
||||
getContentPane().setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup().addGap(34, 34, 34).addComponent(jButtonRefresh)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 97,
|
||||
Short.MAX_VALUE)
|
||||
.addComponent(jButtonExit).addGap(40, 40, 40))
|
||||
.addGroup(layout.createSequentialGroup().addContainerGap()
|
||||
.addComponent(jPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
|
||||
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
|
||||
layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(layout.createSequentialGroup().addContainerGap()
|
||||
.addComponent(jPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
|
||||
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jButtonRefresh).addComponent(jButtonExit))
|
||||
.addContainerGap()));
|
||||
|
||||
pack();
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void jButtonStartActionPerformed(java.awt.event.ActionEvent evt)
|
||||
{
|
||||
JavaDemo.g_lVoiceHandle = hCNetSDK.NET_DVR_StartVoiceCom_V30(m_lUserID, m_iSel + 1,
|
||||
jComboBoxDataType.getSelectedIndex() == 1, fVoiceDataCallBack, null);
|
||||
if (JavaDemo.g_lVoiceHandle.intValue() == -1)
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("VoiceTalk failed,error code:" + hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(0, 0, 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
EnableCtrl();
|
||||
|
||||
}
|
||||
|
||||
private void jButtonStopActionPerformed(java.awt.event.ActionEvent evt)
|
||||
{
|
||||
if (JavaDemo.g_lVoiceHandle.intValue() >= 0)
|
||||
{
|
||||
if (hCNetSDK.NET_DVR_StopVoiceCom(JavaDemo.g_lVoiceHandle))
|
||||
{
|
||||
JavaDemo.g_lVoiceHandle.setValue(-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage(
|
||||
"Close voice talk failed,error code:" + hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(0, 0, 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
}
|
||||
EnableCtrl();
|
||||
}
|
||||
|
||||
private void jComboBoxVoiceChannelActionPerformed(java.awt.event.ActionEvent evt)
|
||||
{
|
||||
if (!m_bInitialed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
m_iSel = jComboBoxVoiceChannel.getSelectedIndex();
|
||||
if (0 == m_strWorkState.byAudioChanStatus[m_iSel])
|
||||
{
|
||||
jLabelStatus.setText("Not use");
|
||||
jLabelStatus.setVisible(true);
|
||||
}
|
||||
else if (1 == m_strWorkState.byAudioChanStatus[m_iSel])
|
||||
{
|
||||
jLabelStatus.setText("use");
|
||||
jLabelStatus.setVisible(true);
|
||||
}
|
||||
else if (0xff == m_strWorkState.byAudioChanStatus[m_iSel])
|
||||
{
|
||||
jLabelStatus.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void jButtonRefreshActionPerformed(java.awt.event.ActionEvent evt)
|
||||
{
|
||||
if (!hCNetSDK.NET_DVR_GetDVRWorkState_V30(m_lUserID, m_strWorkState))
|
||||
{
|
||||
|
||||
DialogMessage dlg = new DialogMessage(
|
||||
"Get work progress failed,error code:" + hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(0, 0, 370, 200);
|
||||
dlg.setVisible(true);
|
||||
jLabelStatus.setVisible(false);
|
||||
return;
|
||||
}
|
||||
|
||||
m_iSel = jComboBoxVoiceChannel.getSelectedIndex();
|
||||
if (0 == m_strWorkState.byAudioChanStatus[m_iSel])
|
||||
{
|
||||
jLabelStatus.setText("not use");
|
||||
jLabelStatus.setVisible(true);
|
||||
}
|
||||
else if (1 == m_strWorkState.byAudioChanStatus[m_iSel])
|
||||
{
|
||||
jLabelStatus.setText("use");
|
||||
jLabelStatus.setVisible(true);
|
||||
}
|
||||
else if (0xff == m_strWorkState.byAudioChanStatus[m_iSel])
|
||||
{
|
||||
jLabelStatus.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void jButtonExitActionPerformed(java.awt.event.ActionEvent evt)
|
||||
{
|
||||
dispose();
|
||||
}
|
||||
|
||||
private void initialDialog()
|
||||
{
|
||||
EnableCtrl();
|
||||
switch (m_strDeviceInfo.byAudioChanNum)
|
||||
{
|
||||
case 1:
|
||||
jComboBoxVoiceChannel.addItem("Audio1");
|
||||
break;
|
||||
case 2:
|
||||
jComboBoxVoiceChannel.addItem("Audio1");
|
||||
jComboBoxVoiceChannel.addItem("Audio2");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
m_strWorkState = new HCNetSDK.NET_DVR_WORKSTATE_V30();
|
||||
if (!hCNetSDK.NET_DVR_GetDVRWorkState_V30(m_lUserID, m_strWorkState))
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage(
|
||||
"Get work progress failed,error code:" + hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(0, 0, 370, 200);
|
||||
dlg.setVisible(true);
|
||||
jLabelStatus.setVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (0 == m_strWorkState.byAudioChanStatus[m_iSel])
|
||||
{
|
||||
jLabelStatus.setText("not use");
|
||||
jLabelStatus.setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (1 == m_strWorkState.byAudioChanStatus[m_iSel])
|
||||
{
|
||||
jLabelStatus.setText("use");
|
||||
jLabelStatus.setVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (0xff == m_strWorkState.byAudioChanStatus[m_iSel])
|
||||
{
|
||||
jLabelStatus.setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void EnableCtrl()
|
||||
{
|
||||
boolean bVoiceTalk = false;
|
||||
if (JavaDemo.g_lVoiceHandle.intValue() >= 0)
|
||||
{
|
||||
bVoiceTalk = true;
|
||||
jLabelStatus.setText("use");
|
||||
}
|
||||
else
|
||||
{
|
||||
bVoiceTalk = false;
|
||||
jLabelStatus.setText("not use");
|
||||
}
|
||||
jButtonStart.setEnabled(!bVoiceTalk);
|
||||
jButtonStop.setEnabled(bVoiceTalk);
|
||||
jComboBoxVoiceChannel.setEnabled(!bVoiceTalk);
|
||||
}
|
||||
|
||||
private javax.swing.JButton jButtonExit;
|
||||
private javax.swing.JButton jButtonRefresh;
|
||||
private javax.swing.JButton jButtonStart;
|
||||
private javax.swing.JButton jButtonStop;
|
||||
private javax.swing.JComboBox jComboBoxDataType;
|
||||
private javax.swing.JComboBox jComboBoxVoiceChannel;
|
||||
private javax.swing.JLabel jLabel1;
|
||||
private javax.swing.JLabel jLabel2;
|
||||
private javax.swing.JLabel jLabelStatus;
|
||||
private javax.swing.JPanel jPanel;
|
||||
|
||||
class FVoiceDataCallBack implements HCNetSDK.FVoiceDataCallBack_V30
|
||||
{
|
||||
|
||||
public void invoke(NativeLong lVoiceComHandle, String pRecvDataBuffer, int dwBufSize, byte byAudioFlag,
|
||||
Pointer pUser)
|
||||
{
|
||||
|
||||
if (byAudioFlag == 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
fLocal.write(pRecvDataBuffer);
|
||||
fLocal.flush();
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.getLogger(DialogVoiceTalk.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (byAudioFlag == 1)
|
||||
{
|
||||
try
|
||||
{
|
||||
fDevice.write(pRecvDataBuffer);
|
||||
fDevice.flush();
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
Logger.getLogger(DialogVoiceTalk.class.getName()).log(Level.SEVERE, null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,387 @@
|
||||
package test;
|
||||
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.NativeLong;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.examples.win32.W32API.HWND;
|
||||
import com.sun.jna.ptr.IntByReference;
|
||||
|
||||
import java.awt.Panel;
|
||||
import java.awt.Color;
|
||||
import javax.swing.JButton;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.JSlider;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
public class ImageCfg extends JDialog {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
static HCNetSDK hCNetSDK = HCNetSDK.INSTANCE;
|
||||
private NativeLong m_lUserID;
|
||||
private int m_iChanNum;
|
||||
private HWND m_hWnd;
|
||||
private HCNetSDK.NET_DVR_CLIENTINFO m_sClientInfo = new HCNetSDK.NET_DVR_CLIENTINFO(); // play structure
|
||||
private NativeLong m_lRealPalyHandle = new NativeLong(-1); // play handle
|
||||
private HCNetSDK.NET_DVR_ISP_CAMERAPARAMCFG m_struISPCameraparamCfg = new HCNetSDK.NET_DVR_ISP_CAMERAPARAMCFG();
|
||||
|
||||
private JTextField m_textFieldBrightness;
|
||||
private JTextField m_textFieldContrast;
|
||||
private JTextField m_textFieldSharpness;
|
||||
private JTextField m_textFieldSaturation;
|
||||
private JSlider m_sliderBrightness;
|
||||
private JSlider m_sliderContrast;
|
||||
private JSlider m_sliderSharpness;
|
||||
private JSlider m_sliderSaturation;
|
||||
private JComboBox<String> m_cmbWhiteBalance;
|
||||
private String [] m_sWhiteBalance = {"MWB", "AWB1", "AWB2", "Locked WB", "Outdoor", "Indoor", "Daylight", "Sodiumlight", "Auto Track", "One Push", "Auto Outdoor", "Auto Sodiumlight", "Mercury Lamp", "Auto", "IncandescentLamp", "Warm Light Lamp", "Natural Light"};
|
||||
private JComboBox<String> m_cmbWDREnabled;
|
||||
private String [] m_sWDREnabled = {"Disable", "Enable", "Auto"};
|
||||
private JComboBox<String> m_cmbBacklightMode;
|
||||
private String [] m_sBacklightMode = {"Off", "UP", "DOWN", "LEFT", "RIGHT", "MIDDLE"};
|
||||
private JComboBox<String> m_cmbScenceMode;
|
||||
private String [] m_sScenceMode = {"Indoor", "Outdoor", "Default", "Low Light"};
|
||||
private JComboBox<String> m_cmbDefogMode;
|
||||
private String [] m_sDefogMode = {"Disable", "Auto", "Normally Open"};
|
||||
private JComboBox<String> m_cmbElectronicstAblization;
|
||||
private String [] m_sElectronicstAblization = {"Disable", "Enable"};
|
||||
private JComboBox<String> m_cmbCorridorMode;
|
||||
private String [] m_sCorridorMode = {"Disable", "Enable"};
|
||||
private JComboBox<String> m_cmbMirror;
|
||||
private String [] m_sMirror = {"Close", "Left and Right", "Up and Down", "Middle"};
|
||||
|
||||
/**
|
||||
* Create the panel.
|
||||
*/
|
||||
public ImageCfg(NativeLong lUserID, int iChanNum) {
|
||||
final Panel m_panelPlay = new Panel();
|
||||
m_panelPlay.setBackground(Color.DARK_GRAY);
|
||||
m_panelPlay.setBounds(10, 10, 373, 313);
|
||||
getContentPane().add(m_panelPlay);
|
||||
|
||||
this.addWindowListener(new WindowAdapter()
|
||||
{
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e)
|
||||
{
|
||||
long lRealPalyHandle = m_lRealPalyHandle.longValue();
|
||||
if (lRealPalyHandle > 0)
|
||||
{
|
||||
hCNetSDK.NET_DVR_StopRealPlay(m_lRealPalyHandle);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
addComponentListener(new ComponentAdapter() {
|
||||
@Override
|
||||
public void componentShown(ComponentEvent arg0) {
|
||||
m_hWnd = new HWND(Native.getComponentPointer(m_panelPlay));
|
||||
m_sClientInfo.hPlayWnd = m_hWnd;
|
||||
m_sClientInfo.lChannel = new NativeLong(m_iChanNum);
|
||||
m_lRealPalyHandle = hCNetSDK.NET_DVR_RealPlay_V30(m_lUserID, m_sClientInfo, null, null, true);
|
||||
long lRealPalyHandle = m_lRealPalyHandle.longValue();
|
||||
if (-1 == lRealPalyHandle)
|
||||
{
|
||||
int iErr = hCNetSDK.NET_DVR_GetLastError();
|
||||
DialogMessage dlg = new DialogMessage("start preview failed,error code is:"+iErr);
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
setTitle("Image Configure");
|
||||
InitImageCfg();
|
||||
getContentPane().setLayout(null);
|
||||
m_lUserID = lUserID;
|
||||
m_iChanNum = iChanNum;
|
||||
|
||||
JLabel lblBrightnessLevel = new JLabel("Brightness Level");
|
||||
lblBrightnessLevel.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblBrightnessLevel.setBounds(389, 24, 131, 15);
|
||||
getContentPane().add(lblBrightnessLevel);
|
||||
|
||||
JLabel lblContrastLevel = new JLabel("Contrast Level");
|
||||
lblContrastLevel.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblContrastLevel.setBounds(389, 54, 131, 15);
|
||||
getContentPane().add(lblContrastLevel);
|
||||
|
||||
JLabel lblSharpnessLevel = new JLabel("Sharpness Level");
|
||||
lblSharpnessLevel.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblSharpnessLevel.setBounds(389, 84, 131, 15);
|
||||
getContentPane().add(lblSharpnessLevel);
|
||||
|
||||
JLabel lblSaturationLevel = new JLabel("Saturation Level");
|
||||
lblSaturationLevel.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblSaturationLevel.setBounds(389, 114, 131, 15);
|
||||
getContentPane().add(lblSaturationLevel);
|
||||
|
||||
JLabel lblWhiteBalance = new JLabel("White Balance");
|
||||
lblWhiteBalance.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblWhiteBalance.setBounds(389, 144, 131, 15);
|
||||
getContentPane().add(lblWhiteBalance);
|
||||
|
||||
JLabel lblWDREnabled = new JLabel("WDR Enabled");
|
||||
lblWDREnabled.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblWDREnabled.setBounds(389, 174, 131, 15);
|
||||
getContentPane().add(lblWDREnabled);
|
||||
|
||||
JLabel lblBacklightMode = new JLabel("Backlight Mode");
|
||||
lblBacklightMode.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblBacklightMode.setBounds(389, 204, 131, 15);
|
||||
getContentPane().add(lblBacklightMode);
|
||||
|
||||
JLabel lblScenceMode = new JLabel("Scence Mode");
|
||||
lblScenceMode.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblScenceMode.setBounds(389, 234, 131, 15);
|
||||
getContentPane().add(lblScenceMode);
|
||||
|
||||
JLabel lblDefogMode = new JLabel("Defog Mode");
|
||||
lblDefogMode.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblDefogMode.setBounds(389, 264, 131, 15);
|
||||
getContentPane().add(lblDefogMode);
|
||||
|
||||
JLabel lblElectronicstAblization = new JLabel("Electronicst Ablization");
|
||||
lblElectronicstAblization.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblElectronicstAblization.setBounds(389, 294, 131, 15);
|
||||
getContentPane().add(lblElectronicstAblization);
|
||||
|
||||
JLabel lblCorridorMode = new JLabel("Corridor Mode");
|
||||
lblCorridorMode.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblCorridorMode.setBounds(389, 324, 131, 15);
|
||||
getContentPane().add(lblCorridorMode);
|
||||
|
||||
JLabel lblMirror = new JLabel("Mirror");
|
||||
lblMirror.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblMirror.setBounds(389, 354, 131, 15);
|
||||
getContentPane().add(lblMirror);
|
||||
|
||||
m_sliderBrightness = new JSlider();
|
||||
m_sliderBrightness.addChangeListener(new ChangeListener() {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
if ((JSlider)e.getSource() == m_sliderBrightness)
|
||||
{
|
||||
m_textFieldBrightness.setText(""+m_sliderBrightness.getValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
m_sliderBrightness.setBounds(530, 24, 177, 23);
|
||||
getContentPane().add(m_sliderBrightness);
|
||||
|
||||
m_sliderContrast = new JSlider();
|
||||
m_sliderContrast.addChangeListener(new ChangeListener() {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
if ((JSlider)e.getSource() == m_sliderContrast)
|
||||
{
|
||||
m_textFieldContrast.setText(""+m_sliderContrast.getValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
m_sliderContrast.setBounds(530, 54, 177, 23);
|
||||
getContentPane().add(m_sliderContrast);
|
||||
|
||||
m_sliderSharpness = new JSlider();
|
||||
m_sliderSharpness.addChangeListener(new ChangeListener() {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
if ((JSlider)e.getSource() == m_sliderSharpness)
|
||||
{
|
||||
m_textFieldSharpness.setText(""+m_sliderSharpness.getValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
m_sliderSharpness.setBounds(530, 84, 177, 23);
|
||||
getContentPane().add(m_sliderSharpness);
|
||||
|
||||
m_sliderSaturation = new JSlider();
|
||||
m_sliderSaturation.addChangeListener(new ChangeListener() {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
if ((JSlider)e.getSource() == m_sliderSaturation)
|
||||
{
|
||||
m_textFieldSaturation.setText(""+m_sliderSaturation.getValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
m_sliderSaturation.setBounds(530, 114, 177, 23);
|
||||
getContentPane().add(m_sliderSaturation);
|
||||
|
||||
m_textFieldBrightness = new JTextField();
|
||||
m_textFieldBrightness.setText("50");
|
||||
m_textFieldBrightness.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
m_textFieldBrightness.setEditable(false);
|
||||
m_textFieldBrightness.setColumns(10);
|
||||
m_textFieldBrightness.setBounds(708, 24, 32, 21);
|
||||
getContentPane().add(m_textFieldBrightness);
|
||||
|
||||
m_textFieldContrast = new JTextField();
|
||||
m_textFieldContrast.setText("50");
|
||||
m_textFieldContrast.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
m_textFieldContrast.setEditable(false);
|
||||
m_textFieldContrast.setColumns(10);
|
||||
m_textFieldContrast.setBounds(708, 54, 32, 21);
|
||||
getContentPane().add(m_textFieldContrast);
|
||||
|
||||
m_textFieldSharpness = new JTextField();
|
||||
m_textFieldSharpness.setText("50");
|
||||
m_textFieldSharpness.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
m_textFieldSharpness.setEditable(false);
|
||||
m_textFieldSharpness.setColumns(10);
|
||||
m_textFieldSharpness.setBounds(708, 84, 32, 21);
|
||||
getContentPane().add(m_textFieldSharpness);
|
||||
|
||||
m_textFieldSaturation = new JTextField();
|
||||
m_textFieldSaturation.setText("50");
|
||||
m_textFieldSaturation.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
m_textFieldSaturation.setEditable(false);
|
||||
m_textFieldSaturation.setColumns(10);
|
||||
m_textFieldSaturation.setBounds(708, 114, 32, 21);
|
||||
getContentPane().add(m_textFieldSaturation);
|
||||
|
||||
m_cmbWhiteBalance = new JComboBox<String>();
|
||||
m_cmbWhiteBalance.setModel(new DefaultComboBoxModel<String>(m_sWhiteBalance));
|
||||
m_cmbWhiteBalance.setBounds(530, 141, 177, 21);
|
||||
getContentPane().add(m_cmbWhiteBalance);
|
||||
|
||||
m_cmbWDREnabled = new JComboBox<String>();
|
||||
m_cmbWDREnabled.setModel(new DefaultComboBoxModel<String>(m_sWDREnabled));
|
||||
m_cmbWDREnabled.setBounds(530, 171, 177, 21);
|
||||
getContentPane().add(m_cmbWDREnabled);
|
||||
|
||||
m_cmbBacklightMode = new JComboBox<String>();
|
||||
m_cmbBacklightMode.setModel(new DefaultComboBoxModel<String>(m_sBacklightMode));
|
||||
m_cmbBacklightMode.setBounds(530, 201, 177, 21);
|
||||
getContentPane().add(m_cmbBacklightMode);
|
||||
|
||||
m_cmbScenceMode = new JComboBox<String>();
|
||||
m_cmbScenceMode.setModel(new DefaultComboBoxModel<String>(m_sScenceMode));
|
||||
m_cmbScenceMode.setBounds(530, 231, 177, 21);
|
||||
getContentPane().add(m_cmbScenceMode);
|
||||
|
||||
m_cmbDefogMode = new JComboBox<String>();
|
||||
m_cmbDefogMode.setModel(new DefaultComboBoxModel<String>(m_sDefogMode));
|
||||
m_cmbDefogMode.setBounds(530, 261, 177, 21);
|
||||
getContentPane().add(m_cmbDefogMode);
|
||||
|
||||
m_cmbElectronicstAblization = new JComboBox<String>();
|
||||
m_cmbElectronicstAblization.setModel(new DefaultComboBoxModel<String>(m_sElectronicstAblization));
|
||||
m_cmbElectronicstAblization.setBounds(530, 291, 177, 21);
|
||||
getContentPane().add(m_cmbElectronicstAblization);
|
||||
|
||||
m_cmbCorridorMode = new JComboBox<String>();
|
||||
m_cmbCorridorMode.setModel(new DefaultComboBoxModel<String>(m_sCorridorMode));
|
||||
m_cmbCorridorMode.setBounds(530, 321, 177, 21);
|
||||
getContentPane().add(m_cmbCorridorMode);
|
||||
|
||||
m_cmbMirror = new JComboBox<String>();
|
||||
m_cmbMirror.setModel(new DefaultComboBoxModel<String>(m_sMirror));
|
||||
m_cmbMirror.setBounds(530, 351, 177, 21);
|
||||
getContentPane().add(m_cmbMirror);
|
||||
|
||||
JButton btnGet = new JButton("Get");
|
||||
btnGet.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Pointer lpISPCameraparamCfg = m_struISPCameraparamCfg.getPointer();
|
||||
IntByReference ibrBytesReturned = new IntByReference(0);
|
||||
|
||||
m_struISPCameraparamCfg.write();
|
||||
if(false == hCNetSDK.NET_DVR_GetDVRConfig(m_lUserID, HCNetSDK.NET_DVR_GET_ISP_CAMERAPARAMCFG, new NativeLong(m_iChanNum), lpISPCameraparamCfg, m_struISPCameraparamCfg.size(), ibrBytesReturned))
|
||||
{
|
||||
int iErr = hCNetSDK.NET_DVR_GetLastError();
|
||||
DialogMessage dlg = new DialogMessage("get failed,error code is: "+iErr);
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("get succeed!");
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
m_struISPCameraparamCfg.read();
|
||||
|
||||
GetISPCameraparamCfg(m_struISPCameraparamCfg.struSelfAdaptiveParam);
|
||||
}
|
||||
});
|
||||
btnGet.setBounds(438, 420, 82, 23);
|
||||
getContentPane().add(btnGet);
|
||||
|
||||
JButton btnSet = new JButton("Set");
|
||||
btnSet.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
SetISPCameraparamCfg(m_struISPCameraparamCfg.struSelfAdaptiveParam);
|
||||
Pointer lpISPCameraparamCfg = m_struISPCameraparamCfg.getPointer();
|
||||
|
||||
m_struISPCameraparamCfg.write();
|
||||
if(false == hCNetSDK.NET_DVR_SetDVRConfig(m_lUserID, HCNetSDK.NET_DVR_SET_ISP_CAMERAPARAMCFG, new NativeLong(m_iChanNum), lpISPCameraparamCfg, m_struISPCameraparamCfg.size()))
|
||||
{
|
||||
int iErr = hCNetSDK.NET_DVR_GetLastError();
|
||||
DialogMessage dlg = new DialogMessage("set failed,error code is: "+iErr);
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("set succeed!");
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
m_struISPCameraparamCfg.read();
|
||||
}
|
||||
});
|
||||
btnSet.setBounds(635, 420, 82, 23);
|
||||
getContentPane().add(btnSet);
|
||||
}
|
||||
|
||||
private void InitImageCfg()
|
||||
{
|
||||
m_struISPCameraparamCfg.dwSize = m_struISPCameraparamCfg.size();
|
||||
}
|
||||
|
||||
private void GetISPCameraparamCfg(HCNetSDK.NET_DVR_CAMERAPARAMCFG_EX struCameraparamCfg)
|
||||
{
|
||||
m_sliderBrightness.setValue(struCameraparamCfg.struVideoEffect.byBrightnessLevel);
|
||||
m_sliderContrast.setValue(struCameraparamCfg.struVideoEffect.byContrastLevel);
|
||||
m_sliderSharpness.setValue(struCameraparamCfg.struVideoEffect.bySharpnessLevel);
|
||||
m_sliderSaturation.setValue(struCameraparamCfg.struVideoEffect.bySaturationLevel);
|
||||
m_cmbWhiteBalance.setSelectedIndex(struCameraparamCfg.struWhiteBalance.byWhiteBalanceMode);
|
||||
m_cmbWDREnabled.setSelectedIndex(struCameraparamCfg.struWdr.byWDREnabled);
|
||||
m_cmbBacklightMode.setSelectedIndex(struCameraparamCfg.struBackLight.byBacklightMode);
|
||||
m_cmbScenceMode.setSelectedIndex(struCameraparamCfg.bySceneMode);
|
||||
m_cmbDefogMode.setSelectedIndex(struCameraparamCfg.struDefogCfg.byMode);
|
||||
m_cmbElectronicstAblization.setSelectedIndex(struCameraparamCfg.struElectronicStabilization.byEnable);
|
||||
m_cmbCorridorMode.setSelectedIndex(struCameraparamCfg.struCorridorMode.byEnableCorridorMode);
|
||||
m_cmbMirror.setSelectedIndex(struCameraparamCfg.byMirror);
|
||||
}
|
||||
|
||||
private void SetISPCameraparamCfg(HCNetSDK.NET_DVR_CAMERAPARAMCFG_EX struCameraparamCfg)
|
||||
{
|
||||
struCameraparamCfg.struVideoEffect.byBrightnessLevel = (byte)m_sliderBrightness.getValue();
|
||||
struCameraparamCfg.struVideoEffect.byContrastLevel = (byte)m_sliderContrast.getValue();
|
||||
struCameraparamCfg.struVideoEffect.bySharpnessLevel = (byte)m_sliderSharpness.getValue();
|
||||
struCameraparamCfg.struVideoEffect.bySaturationLevel = (byte)m_sliderSaturation.getValue();
|
||||
struCameraparamCfg.struWhiteBalance.byWhiteBalanceMode = (byte)m_cmbWhiteBalance.getSelectedIndex();
|
||||
struCameraparamCfg.struWdr.byWDREnabled = (byte)m_cmbWDREnabled.getSelectedIndex();
|
||||
struCameraparamCfg.struBackLight.byBacklightMode = (byte)m_cmbBacklightMode.getSelectedIndex();
|
||||
struCameraparamCfg.bySceneMode = (byte)m_cmbScenceMode.getSelectedIndex();
|
||||
struCameraparamCfg.struDefogCfg.byMode = (byte)m_cmbDefogMode.getSelectedIndex();
|
||||
struCameraparamCfg.struElectronicStabilization.byEnable = (byte)m_cmbElectronicstAblization.getSelectedIndex();
|
||||
struCameraparamCfg.struCorridorMode.byEnableCorridorMode = (byte)m_cmbCorridorMode.getSelectedIndex();
|
||||
struCameraparamCfg.byMirror = (byte)m_cmbMirror.getSelectedIndex();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package test;
|
||||
import javax.swing.tree.DefaultMutableTreeNode;
|
||||
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class MyTreeNode extends DefaultMutableTreeNode
|
||||
{
|
||||
public boolean m_isOnLine;
|
||||
|
||||
public MyTreeNode()
|
||||
{
|
||||
// TODO Auto-generated constructor stub
|
||||
super();
|
||||
m_isOnLine=true;
|
||||
}
|
||||
|
||||
public MyTreeNode(Object o)
|
||||
{
|
||||
super(o);
|
||||
m_isOnLine=true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package test;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
|
||||
import javax.swing.JTree;
|
||||
import javax.swing.tree.DefaultTreeCellRenderer;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class NodeRenderer extends DefaultTreeCellRenderer
|
||||
{
|
||||
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
|
||||
boolean leaf, int row, boolean hasFocus)
|
||||
{
|
||||
super.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
|
||||
MyTreeNode node = (MyTreeNode) value;
|
||||
if (node.m_isOnLine == true)
|
||||
{
|
||||
setForeground(Color.BLACK);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
setForeground(Color.RED);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,883 @@
|
||||
package test;
|
||||
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.TitledBorder;
|
||||
|
||||
import com.sun.jna.NativeLong;
|
||||
|
||||
import test.HCNetSDK.NET_DVR_PTZ_PATTERN;
|
||||
|
||||
import java.awt.Font;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.border.EtchedBorder;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JComboBox;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.UIManager;
|
||||
import java.awt.Color;
|
||||
|
||||
public class PanelPTZ extends JPanel
|
||||
{
|
||||
|
||||
protected final Logger log = Logger.getLogger(this.getClass().getName());
|
||||
private NativeLong m_lRealHandle; // preview handle
|
||||
private NativeLong m_lUserID; // LogID
|
||||
private int m_iChannelNum; // channel num
|
||||
|
||||
private JComboBox comboBoxPresetPoint;
|
||||
private JComboBox comboBoxCruiseRoute;
|
||||
private JComboBox comboBoxSpeed;
|
||||
private JComboBox comboBoxPatternScan;
|
||||
|
||||
/**
|
||||
* Create the panel.
|
||||
*/
|
||||
public PanelPTZ()
|
||||
{
|
||||
InitCompnent();
|
||||
InitPTZParam();
|
||||
|
||||
}
|
||||
|
||||
public void SetParam(NativeLong lUserID, NativeLong lRealHandle, int iChannelNum)
|
||||
{
|
||||
m_lUserID = lUserID;
|
||||
m_lRealHandle = lRealHandle;
|
||||
m_iChannelNum = iChannelNum;
|
||||
}
|
||||
|
||||
public void InitCompnent()
|
||||
{
|
||||
setLayout(null);
|
||||
JPanel panel_15 = new JPanel();
|
||||
panel_15.setLayout(null);
|
||||
panel_15.setFont(new Font("Times New Roman", Font.PLAIN, 12));
|
||||
panel_15.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "PTZ Control",
|
||||
TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
||||
panel_15.setBounds(0, 5, 210, 457);
|
||||
add(panel_15);
|
||||
|
||||
JPanel panel_16 = new JPanel();
|
||||
panel_16.setLayout(null);
|
||||
panel_16.setBounds(10, 21, 196, 199);
|
||||
panel_15.add(panel_16);
|
||||
|
||||
JButton buttonUp = new JButton("Up");
|
||||
buttonUp.addMouseListener(new MouseAdapter()
|
||||
{
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e)
|
||||
{
|
||||
UpMousePress(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e)
|
||||
{
|
||||
UpMouseRelease(e);
|
||||
}
|
||||
});
|
||||
buttonUp.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonUp.setFocusable(false);
|
||||
buttonUp.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonUp.setBounds(70, 10, 57, 23);
|
||||
panel_16.add(buttonUp);
|
||||
|
||||
JButton buttonLeft = new JButton("Left");
|
||||
buttonLeft.addMouseListener(new MouseAdapter()
|
||||
{
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e)
|
||||
{
|
||||
LeftMousePress(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e)
|
||||
{
|
||||
LeftMouseRelease(e);
|
||||
}
|
||||
});
|
||||
buttonLeft.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonLeft.setFocusable(false);
|
||||
buttonLeft.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonLeft.setBounds(10, 34, 57, 23);
|
||||
panel_16.add(buttonLeft);
|
||||
|
||||
JButton buttonRight = new JButton("Right");
|
||||
buttonRight.addMouseListener(new MouseAdapter()
|
||||
{
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e)
|
||||
{
|
||||
RightMousePress(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e)
|
||||
{
|
||||
RightMouseRelease(e);
|
||||
}
|
||||
});
|
||||
buttonRight.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonRight.setFocusable(false);
|
||||
buttonRight.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonRight.setBounds(129, 34, 57, 23);
|
||||
panel_16.add(buttonRight);
|
||||
|
||||
JButton buttonDown = new JButton("Down");
|
||||
buttonDown.addMouseListener(new MouseAdapter()
|
||||
{
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e)
|
||||
{
|
||||
DownMousePress(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e)
|
||||
{
|
||||
DownMouseRelease(e);
|
||||
}
|
||||
});
|
||||
buttonDown.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonDown.setFocusable(false);
|
||||
buttonDown.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonDown.setBounds(70, 57, 57, 23);
|
||||
panel_16.add(buttonDown);
|
||||
|
||||
JButton buttonIn = new JButton("In");
|
||||
buttonIn.addMouseListener(new MouseAdapter()
|
||||
{
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e)
|
||||
{
|
||||
ZoomInMousePress(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e)
|
||||
{
|
||||
ZoomInMouseRelease(e);
|
||||
}
|
||||
});
|
||||
buttonIn.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonIn.setFocusable(false);
|
||||
buttonIn.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonIn.setBounds(10, 87, 57, 23);
|
||||
panel_16.add(buttonIn);
|
||||
|
||||
JLabel label_15 = new JLabel("Zoom");
|
||||
label_15.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
label_15.setBounds(89, 91, 38, 15);
|
||||
panel_16.add(label_15);
|
||||
|
||||
JButton buttonOut = new JButton("Out");
|
||||
buttonOut.addMouseListener(new MouseAdapter()
|
||||
{
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e)
|
||||
{
|
||||
ZoomOutMousePress(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e)
|
||||
{
|
||||
ZoomOutMouseRelease(e);
|
||||
}
|
||||
});
|
||||
buttonOut.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonOut.setFocusable(false);
|
||||
buttonOut.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonOut.setBounds(129, 87, 57, 23);
|
||||
panel_16.add(buttonOut);
|
||||
|
||||
JButton buttonNear = new JButton("Near");
|
||||
buttonNear.addMouseListener(new MouseAdapter()
|
||||
{
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e)
|
||||
{
|
||||
FocusNearMousePress(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e)
|
||||
{
|
||||
FocusNearMouseRelease(e);
|
||||
}
|
||||
});
|
||||
buttonNear.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonNear.setFocusable(false);
|
||||
buttonNear.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonNear.setBounds(10, 116, 57, 23);
|
||||
panel_16.add(buttonNear);
|
||||
|
||||
JLabel label_16 = new JLabel("Focus");
|
||||
label_16.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
label_16.setBounds(89, 120, 38, 15);
|
||||
panel_16.add(label_16);
|
||||
|
||||
JButton buttonFar = new JButton("Far");
|
||||
buttonFar.addMouseListener(new MouseAdapter()
|
||||
{
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e)
|
||||
{
|
||||
FocusFarMousePress(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e)
|
||||
{
|
||||
FocusFarMouseRelease(e);
|
||||
}
|
||||
});
|
||||
buttonFar.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonFar.setFocusable(false);
|
||||
buttonFar.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonFar.setBounds(129, 116, 57, 23);
|
||||
panel_16.add(buttonFar);
|
||||
|
||||
JButton buttonOpen = new JButton("Open");
|
||||
buttonOpen.addMouseListener(new MouseAdapter()
|
||||
{
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e)
|
||||
{
|
||||
IrisOpenMousePress(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e)
|
||||
{
|
||||
IrisOpenMouseRelease(e);
|
||||
}
|
||||
});
|
||||
buttonOpen.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonOpen.setFocusable(false);
|
||||
buttonOpen.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonOpen.setBounds(10, 143, 57, 23);
|
||||
panel_16.add(buttonOpen);
|
||||
|
||||
JLabel label_17 = new JLabel("Iris");
|
||||
label_17.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
label_17.setBounds(89, 147, 38, 15);
|
||||
panel_16.add(label_17);
|
||||
|
||||
JButton buttonClose = new JButton("Close");
|
||||
buttonClose.addMouseListener(new MouseAdapter()
|
||||
{
|
||||
@Override
|
||||
public void mousePressed(MouseEvent e)
|
||||
{
|
||||
IrisCloseMousePress(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseReleased(MouseEvent e)
|
||||
{
|
||||
IrisCloseMouseRelease(e);
|
||||
}
|
||||
});
|
||||
buttonClose.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonClose.setFocusable(false);
|
||||
buttonClose.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonClose.setBounds(129, 143, 57, 23);
|
||||
panel_16.add(buttonClose);
|
||||
|
||||
JLabel label_18 = new JLabel("PTZ Speed");
|
||||
label_18.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
label_18.setBounds(13, 174, 54, 15);
|
||||
panel_16.add(label_18);
|
||||
|
||||
comboBoxSpeed = new JComboBox();
|
||||
comboBoxSpeed.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
comboBoxSpeed.setFocusable(false);
|
||||
comboBoxSpeed.setBounds(80, 172, 106, 21);
|
||||
panel_16.add(comboBoxSpeed);
|
||||
|
||||
JPanel panel_17 = new JPanel();
|
||||
panel_17.setLayout(null);
|
||||
panel_17.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
panel_17.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Preset Point",
|
||||
TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
||||
panel_17.setBounds(10, 220, 196, 49);
|
||||
panel_15.add(panel_17);
|
||||
|
||||
comboBoxPresetPoint = new JComboBox();
|
||||
comboBoxPresetPoint.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
comboBoxPresetPoint.setFocusable(false);
|
||||
comboBoxPresetPoint.setBounds(10, 20, 42, 21);
|
||||
panel_17.add(comboBoxPresetPoint);
|
||||
|
||||
JButton buttonCall = new JButton("Call");
|
||||
buttonCall.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
PresetPointActionPerformed(e);
|
||||
}
|
||||
});
|
||||
buttonCall.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonCall.setFocusable(false);
|
||||
buttonCall.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonCall.setBounds(58, 19, 42, 23);
|
||||
panel_17.add(buttonCall);
|
||||
|
||||
JButton buttonSet = new JButton("Set");
|
||||
buttonSet.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
SetPresetPointActionPerformed(e);
|
||||
}
|
||||
});
|
||||
buttonSet.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonSet.setFocusable(false);
|
||||
buttonSet.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonSet.setBounds(104, 19, 42, 23);
|
||||
panel_17.add(buttonSet);
|
||||
|
||||
JButton buttonDel = new JButton("Del");
|
||||
buttonDel.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
DelPresetPointActionPerformed(e);
|
||||
}
|
||||
});
|
||||
buttonDel.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonDel.setFocusable(false);
|
||||
buttonDel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonDel.setBounds(149, 19, 37, 23);
|
||||
panel_17.add(buttonDel);
|
||||
|
||||
JPanel panel_18 = new JPanel();
|
||||
panel_18.setLayout(null);
|
||||
panel_18.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
panel_18.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Cruise Route",
|
||||
TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
||||
panel_18.setBounds(10, 269, 196, 55);
|
||||
panel_15.add(panel_18);
|
||||
|
||||
comboBoxCruiseRoute = new JComboBox();
|
||||
comboBoxCruiseRoute.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
comboBoxCruiseRoute.setFocusable(false);
|
||||
comboBoxCruiseRoute.setBounds(10, 23, 39, 21);
|
||||
panel_18.add(comboBoxCruiseRoute);
|
||||
|
||||
JButton buttonCall1 = new JButton("Call");
|
||||
buttonCall1.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
CruiseRouteActionPerformed(e);
|
||||
}
|
||||
});
|
||||
buttonCall1.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonCall1.setFocusable(false);
|
||||
buttonCall1.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonCall1.setBounds(51, 23, 39, 23);
|
||||
panel_18.add(buttonCall1);
|
||||
|
||||
JButton buttonDel1 = new JButton("Del");
|
||||
buttonDel1.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
DelCruiseRouteActionPerformed(e);
|
||||
}
|
||||
});
|
||||
buttonDel1.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonDel1.setFocusable(false);
|
||||
buttonDel1.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonDel1.setBounds(138, 23, 50, 23);
|
||||
panel_18.add(buttonDel1);
|
||||
|
||||
JButton buttonSet1 = new JButton("Set");
|
||||
buttonSet1.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
SetCruiseRouteActionPerformed(e);
|
||||
}
|
||||
});
|
||||
buttonSet1.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonSet1.setFocusable(false);
|
||||
buttonSet1.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonSet1.setBounds(89, 23, 50, 23);
|
||||
panel_18.add(buttonSet1);
|
||||
|
||||
JPanel panel_19 = new JPanel();
|
||||
panel_19.setLayout(null);
|
||||
panel_19.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
panel_19.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Pattern Scan",
|
||||
TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));
|
||||
panel_19.setBounds(10, 334, 196, 108);
|
||||
panel_15.add(panel_19);
|
||||
|
||||
JLabel label_19 = new JLabel("ID");
|
||||
label_19.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
label_19.setBounds(10, 21, 21, 15);
|
||||
panel_19.add(label_19);
|
||||
|
||||
comboBoxPatternScan = new JComboBox();
|
||||
comboBoxPatternScan.setModel(new DefaultComboBoxModel(new String[] { "1", "2", "3", "4" }));
|
||||
comboBoxPatternScan.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
comboBoxPatternScan.setFocusable(false);
|
||||
comboBoxPatternScan.setBounds(30, 18, 41, 21);
|
||||
panel_19.add(comboBoxPatternScan);
|
||||
|
||||
JButton buttonStartMem = new JButton("Start Mem");
|
||||
buttonStartMem.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
StartMemActionPerformed(e);
|
||||
}
|
||||
});
|
||||
buttonStartMem.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonStartMem.setFocusable(false);
|
||||
buttonStartMem.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonStartMem.setBounds(10, 72, 83, 23);
|
||||
panel_19.add(buttonStartMem);
|
||||
|
||||
JButton buttonStopMem = new JButton("Stop Mem");
|
||||
buttonStopMem.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
StopMemActionPerformed(e);
|
||||
}
|
||||
});
|
||||
buttonStopMem.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonStopMem.setFocusable(false);
|
||||
buttonStopMem.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonStopMem.setBounds(97, 72, 89, 23);
|
||||
panel_19.add(buttonStopMem);
|
||||
|
||||
JButton buttonDelOne = new JButton("Del One");
|
||||
buttonDelOne.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
DelOnePatterScanActionPerformed(e);
|
||||
}
|
||||
});
|
||||
buttonDelOne.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonDelOne.setFocusable(false);
|
||||
buttonDelOne.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonDelOne.setBounds(10, 46, 83, 23);
|
||||
panel_19.add(buttonDelOne);
|
||||
|
||||
JButton buttonDelAll = new JButton("Del All");
|
||||
buttonDelAll.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
DelAllPatterScanActionPerformed(e);
|
||||
}
|
||||
});
|
||||
buttonDelAll.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonDelAll.setFocusable(false);
|
||||
buttonDelAll.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonDelAll.setBounds(97, 46, 89, 23);
|
||||
panel_19.add(buttonDelAll);
|
||||
|
||||
JButton buttonRun = new JButton("Run");
|
||||
buttonRun.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
RunPatternScanActionPerformed(e);
|
||||
}
|
||||
});
|
||||
buttonRun.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonRun.setFocusable(false);
|
||||
buttonRun.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonRun.setBounds(81, 17, 48, 23);
|
||||
panel_19.add(buttonRun);
|
||||
|
||||
JButton buttonStop = new JButton("Stop");
|
||||
buttonStop.addActionListener(new ActionListener()
|
||||
{
|
||||
public void actionPerformed(ActionEvent e)
|
||||
{
|
||||
StopPatternScanActionPerformed(e);
|
||||
}
|
||||
});
|
||||
buttonStop.setFont(new Font("宋体", Font.PLAIN, 12));
|
||||
buttonStop.setFocusable(false);
|
||||
buttonStop.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
|
||||
buttonStop.setBounds(133, 17, 57, 23);
|
||||
panel_19.add(buttonStop);
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void PTZControlAll(int iPTZCommand, int iStop)
|
||||
{
|
||||
JavaDemo.GetPTZParam();
|
||||
int iSpeed = comboBoxSpeed.getSelectedIndex() + 1;
|
||||
if (!JavaDemo.hCNetSDK.NET_DVR_PTZControlWithSpeed(m_lRealHandle, iPTZCommand, iStop, iSpeed))
|
||||
{
|
||||
//JOptionPane.showMessageDialog(this,"PTZ control fail,error code=" + JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
DialogMessage dlg = new DialogMessage("PTZ control fail,error code:"+JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void InitPTZParam()
|
||||
{
|
||||
int iNum;
|
||||
for (iNum = 0; iNum < HCNetSDK.MAX_CRUISE_V30; iNum++)
|
||||
{
|
||||
comboBoxCruiseRoute.addItem(iNum + 1);
|
||||
}
|
||||
|
||||
for (iNum = 0; iNum < HCNetSDK.MAX_PRESET_V30; iNum++)
|
||||
{
|
||||
comboBoxPresetPoint.addItem(iNum + 1);
|
||||
}
|
||||
|
||||
for (iNum = 0; iNum < 7; iNum++)
|
||||
{
|
||||
comboBoxSpeed.addItem(iNum + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// up
|
||||
private void UpMousePress(MouseEvent e)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.TILT_UP, 0);
|
||||
}
|
||||
|
||||
private void UpMouseRelease(MouseEvent e)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.TILT_UP, 1);
|
||||
}
|
||||
|
||||
// left
|
||||
private void LeftMousePress(MouseEvent event)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.PAN_LEFT, 0);
|
||||
}
|
||||
|
||||
private void LeftMouseRelease(MouseEvent event)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.PAN_LEFT, 1);
|
||||
}
|
||||
|
||||
// right
|
||||
private void RightMousePress(MouseEvent event)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.PAN_RIGHT, 0);
|
||||
}
|
||||
|
||||
private void RightMouseRelease(MouseEvent event)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.PAN_RIGHT, 1);
|
||||
}
|
||||
|
||||
// down
|
||||
private void DownMousePress(MouseEvent event)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.TILT_DOWN, 0);
|
||||
}
|
||||
|
||||
private void DownMouseRelease(MouseEvent event)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.TILT_DOWN, 1);
|
||||
}
|
||||
|
||||
// zoom in
|
||||
private void ZoomInMousePress(MouseEvent event)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.ZOOM_IN, 0);
|
||||
}
|
||||
|
||||
private void ZoomInMouseRelease(MouseEvent event)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.ZOOM_IN, 1);
|
||||
}
|
||||
|
||||
// zoom out
|
||||
private void ZoomOutMousePress(MouseEvent event)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.ZOOM_OUT, 0);
|
||||
}
|
||||
|
||||
private void ZoomOutMouseRelease(MouseEvent event)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.ZOOM_OUT, 1);
|
||||
}
|
||||
|
||||
// focus near
|
||||
private void FocusNearMousePress(MouseEvent event)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.FOCUS_NEAR, 0);
|
||||
}
|
||||
|
||||
private void FocusNearMouseRelease(MouseEvent event)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.FOCUS_NEAR, 1);
|
||||
}
|
||||
|
||||
// focus far
|
||||
private void FocusFarMousePress(MouseEvent event)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.FOCUS_FAR, 0);
|
||||
}
|
||||
|
||||
private void FocusFarMouseRelease(MouseEvent event)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.FOCUS_FAR, 1);
|
||||
}
|
||||
|
||||
// Iris open
|
||||
private void IrisOpenMousePress(MouseEvent event)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.IRIS_OPEN, 0);
|
||||
}
|
||||
|
||||
private void IrisOpenMouseRelease(MouseEvent event)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.IRIS_OPEN, 1);
|
||||
}
|
||||
|
||||
// Iris close
|
||||
private void IrisCloseMousePress(MouseEvent event)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.IRIS_CLOSE, 0);
|
||||
}
|
||||
|
||||
private void IrisCloseMouseRelease(MouseEvent event)
|
||||
{
|
||||
PTZControlAll(HCNetSDK.IRIS_CLOSE, 1);
|
||||
}
|
||||
|
||||
// call preset point
|
||||
private void PresetPointActionPerformed(ActionEvent event)
|
||||
{
|
||||
int iPreset = comboBoxPresetPoint.getSelectedIndex() + 1;
|
||||
if (!JavaDemo.hCNetSDK.NET_DVR_PTZPreset(m_lRealHandle, HCNetSDK.GOTO_PRESET, iPreset))
|
||||
{
|
||||
//JOptionPane.showMessageDialog(this,"call preset point fail,error code=" + JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
DialogMessage dlg = new DialogMessage("call preset point fail,error code:"+JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// set Preset point
|
||||
public void SetPresetPointActionPerformed(ActionEvent e)
|
||||
{
|
||||
JavaDemo.GetPTZParam();
|
||||
int iPreset = comboBoxPresetPoint.getSelectedIndex() + 1;
|
||||
if (!JavaDemo.hCNetSDK.NET_DVR_PTZPreset(m_lRealHandle, HCNetSDK.SET_PRESET, iPreset))
|
||||
{
|
||||
//JOptionPane.showMessageDialog(this,"Set Preset point fail,error code=" + JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
DialogMessage dlg = new DialogMessage("Set preset point fail,error code:"+JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// delete Preset point
|
||||
public void DelPresetPointActionPerformed(ActionEvent event)
|
||||
{
|
||||
JavaDemo.GetPTZParam();
|
||||
int iPreset = comboBoxPresetPoint.getSelectedIndex() + 1;
|
||||
if (!JavaDemo.hCNetSDK.NET_DVR_PTZPreset(m_lRealHandle, HCNetSDK.CLE_PRESET, iPreset))
|
||||
{
|
||||
//JOptionPane.showMessageDialog(this,"delete Preset point fail,error code=" + JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
DialogMessage dlg = new DialogMessage("Delete preset point fail,error code:"+JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// call cruise route
|
||||
public void CruiseRouteActionPerformed(ActionEvent event)
|
||||
{
|
||||
JavaDemo.GetPTZParam();
|
||||
byte iCruise = (byte) (comboBoxCruiseRoute.getSelectedIndex() + 1);
|
||||
if (!JavaDemo.hCNetSDK.NET_DVR_PTZCruise(m_lRealHandle, HCNetSDK.RUN_SEQ, iCruise, (byte) 0, (short) 0))
|
||||
{
|
||||
//JOptionPane.showMessageDialog(this,"call cruise route fail,error code=" + JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
DialogMessage dlg = new DialogMessage("call cruise route fail,error code:"+JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// set cruise route
|
||||
public void SetCruiseRouteActionPerformed(ActionEvent event)
|
||||
{
|
||||
JavaDemo.GetPTZParam();
|
||||
DialogCruiseRoute dlgCruiseRoute = new DialogCruiseRoute(m_lRealHandle);
|
||||
dlgCruiseRoute.setBounds(this.getX() + 200, this.getY() + 200, 450, 270);
|
||||
dlgCruiseRoute.setVisible(true);
|
||||
}
|
||||
|
||||
// del cruise route
|
||||
public void DelCruiseRouteActionPerformed(ActionEvent event)
|
||||
{
|
||||
JavaDemo.GetPTZParam();
|
||||
byte byCruise = (byte) (comboBoxCruiseRoute.getSelectedIndex() + 1);
|
||||
if (!JavaDemo.hCNetSDK.NET_DVR_PTZCruise(m_lRealHandle, HCNetSDK.DEL_SEQ, byCruise, (byte) 0, (short) 0))
|
||||
{
|
||||
//JOptionPane.showMessageDialog(this,"delete cruise route fail,error code=" + JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
DialogMessage dlg = new DialogMessage("delete cruise route fail,error code:"+JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// start memory
|
||||
public void StartMemActionPerformed(ActionEvent e)
|
||||
{
|
||||
JavaDemo.GetPTZParam();
|
||||
int iPatternId = comboBoxPatternScan.getSelectedIndex() + 1;
|
||||
HCNetSDK.NET_DVR_PTZ_PATTERN struPTZPattern = new NET_DVR_PTZ_PATTERN();
|
||||
struPTZPattern.dwChannel = m_iChannelNum;
|
||||
struPTZPattern.dwPatternID = iPatternId;
|
||||
struPTZPattern.dwPatternCmd = HCNetSDK.STA_MEM_CRUISE;
|
||||
struPTZPattern.dwSize = struPTZPattern.size();
|
||||
|
||||
if (!JavaDemo.hCNetSDK.NET_DVR_RemoteControl(m_lUserID, HCNetSDK.NET_DVR_CONTROL_PTZ_PATTERN, struPTZPattern,
|
||||
struPTZPattern.size()))
|
||||
{
|
||||
//JOptionPane.showMessageDialog(this,"start memory fail,error code=" + JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
DialogMessage dlg = new DialogMessage("start memory fail,error code:"+JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// stop memory
|
||||
public void StopMemActionPerformed(ActionEvent event)
|
||||
{
|
||||
JavaDemo.GetPTZParam();
|
||||
int iPatternId = comboBoxPatternScan.getSelectedIndex() + 1;
|
||||
HCNetSDK.NET_DVR_PTZ_PATTERN struPTZPattern = new NET_DVR_PTZ_PATTERN();
|
||||
struPTZPattern.dwChannel = m_iChannelNum;
|
||||
struPTZPattern.dwPatternID = iPatternId;
|
||||
struPTZPattern.dwPatternCmd = HCNetSDK.STO_MEM_CRUISE;
|
||||
struPTZPattern.dwSize = struPTZPattern.size();
|
||||
|
||||
if (!JavaDemo.hCNetSDK.NET_DVR_RemoteControl(m_lUserID, HCNetSDK.NET_DVR_CONTROL_PTZ_PATTERN, struPTZPattern,
|
||||
struPTZPattern.size()))
|
||||
{
|
||||
//JOptionPane.showMessageDialog(this,"stop memory fail,error code=" + JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
DialogMessage dlg = new DialogMessage("stop memory fail,error code:"+JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// start run pattern scan
|
||||
public void RunPatternScanActionPerformed(ActionEvent event)
|
||||
{
|
||||
JavaDemo.GetPTZParam();
|
||||
int iPatternId = comboBoxPatternScan.getSelectedIndex() + 1;
|
||||
HCNetSDK.NET_DVR_PTZ_PATTERN struPTZPattern = new NET_DVR_PTZ_PATTERN();
|
||||
struPTZPattern.dwChannel = m_iChannelNum;
|
||||
struPTZPattern.dwPatternID = iPatternId;
|
||||
struPTZPattern.dwPatternCmd = HCNetSDK.RUN_CRUISE;
|
||||
struPTZPattern.dwSize = struPTZPattern.size();
|
||||
|
||||
if (!JavaDemo.hCNetSDK.NET_DVR_RemoteControl(m_lUserID, HCNetSDK.NET_DVR_CONTROL_PTZ_PATTERN, struPTZPattern,
|
||||
struPTZPattern.size()))
|
||||
{
|
||||
//JOptionPane.showMessageDialog(this,"start run pattern scan fail,error code=" + JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
DialogMessage dlg = new DialogMessage("start run pattern scan ,error code:"+JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// stop run pattern scan
|
||||
public void StopPatternScanActionPerformed(ActionEvent event)
|
||||
{
|
||||
JavaDemo.GetPTZParam();
|
||||
int iPatternId = comboBoxPatternScan.getSelectedIndex() + 1;
|
||||
HCNetSDK.NET_DVR_PTZ_PATTERN struPTZPattern = new NET_DVR_PTZ_PATTERN();
|
||||
struPTZPattern.dwChannel = m_iChannelNum;
|
||||
struPTZPattern.dwPatternID = iPatternId;
|
||||
struPTZPattern.dwPatternCmd = HCNetSDK.STOP_CRUISE;
|
||||
struPTZPattern.dwSize = struPTZPattern.size();
|
||||
|
||||
if (!JavaDemo.hCNetSDK.NET_DVR_RemoteControl(m_lUserID, HCNetSDK.NET_DVR_CONTROL_PTZ_PATTERN, struPTZPattern,
|
||||
struPTZPattern.size()))
|
||||
{
|
||||
//JOptionPane.showMessageDialog(this,"stop run pattern scan fail,error code=" + JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
DialogMessage dlg = new DialogMessage("stop run pattern scan ,error code:"+JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// delete one pattern scan
|
||||
public void DelOnePatterScanActionPerformed(ActionEvent event)
|
||||
{
|
||||
JavaDemo.GetPTZParam();
|
||||
int iPatternId = comboBoxPatternScan.getSelectedIndex() + 1;
|
||||
HCNetSDK.NET_DVR_PTZ_PATTERN struPTZPattern = new NET_DVR_PTZ_PATTERN();
|
||||
struPTZPattern.dwChannel = m_iChannelNum;
|
||||
struPTZPattern.dwPatternID = iPatternId;
|
||||
struPTZPattern.dwPatternCmd = HCNetSDK.DELETE_CRUISE;
|
||||
struPTZPattern.dwSize = struPTZPattern.size();
|
||||
|
||||
if (!JavaDemo.hCNetSDK.NET_DVR_RemoteControl(m_lUserID, HCNetSDK.NET_DVR_CONTROL_PTZ_PATTERN, struPTZPattern,
|
||||
struPTZPattern.size()))
|
||||
{
|
||||
//JOptionPane.showMessageDialog(this,"delete one pattern scan fail,error code=" + JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
DialogMessage dlg = new DialogMessage("delete one pattern scan fail,error code:"+JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// delete all pattern scan
|
||||
public void DelAllPatterScanActionPerformed(ActionEvent event)
|
||||
{
|
||||
JavaDemo.GetPTZParam();
|
||||
HCNetSDK.NET_DVR_PTZ_PATTERN struPTZPattern = new NET_DVR_PTZ_PATTERN();
|
||||
struPTZPattern.dwChannel = m_iChannelNum;
|
||||
struPTZPattern.dwPatternCmd = HCNetSDK.DELETE_ALL_CRUISE;
|
||||
struPTZPattern.dwSize = struPTZPattern.size();
|
||||
|
||||
if (!JavaDemo.hCNetSDK.NET_DVR_RemoteControl(m_lUserID, HCNetSDK.NET_DVR_CONTROL_PTZ_PATTERN, struPTZPattern,
|
||||
struPTZPattern.size()))
|
||||
{
|
||||
//JOptionPane.showMessageDialog(this,"delete all pattern scan fail,error code=" + JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
DialogMessage dlg = new DialogMessage("delete all pattern scan fail,error code:"+JavaDemo.hCNetSDK.NET_DVR_GetLastError());
|
||||
dlg.setBounds(0,0 , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package test;
|
||||
|
||||
import com.sun.jna.NativeLong;
|
||||
|
||||
public class QueueMessage {
|
||||
private HCNetSDK.RECV_ALARM m_palarmInfo;
|
||||
private NativeLong m_command;
|
||||
private HCNetSDK.NET_DVR_ALARMER m_pAlarmer;
|
||||
|
||||
/**
|
||||
* @param palarmInfo
|
||||
* @param command
|
||||
* @param pAlarmer
|
||||
*/
|
||||
public QueueMessage(HCNetSDK.RECV_ALARM palarmInfo,NativeLong command,HCNetSDK.NET_DVR_ALARMER pAlarmer)
|
||||
{
|
||||
m_palarmInfo = palarmInfo;
|
||||
m_command = command;
|
||||
m_pAlarmer = pAlarmer;
|
||||
}
|
||||
|
||||
public void setM_palarmInfo(HCNetSDK.RECV_ALARM m_palarmInfo) {
|
||||
this.m_palarmInfo = m_palarmInfo;
|
||||
}
|
||||
|
||||
public void setM_command(NativeLong m_command) {
|
||||
this.m_command = m_command;
|
||||
}
|
||||
|
||||
public HCNetSDK.RECV_ALARM getM_palarmInfo() {
|
||||
return m_palarmInfo;
|
||||
}
|
||||
|
||||
public NativeLong getM_command() {
|
||||
return m_command;
|
||||
}
|
||||
|
||||
public HCNetSDK.NET_DVR_ALARMER getM_pAlarmer() {
|
||||
return m_pAlarmer;
|
||||
}
|
||||
|
||||
public void setM_pAlarmer(HCNetSDK.NET_DVR_ALARMER m_pAlarmer) {
|
||||
this.m_pAlarmer = m_pAlarmer;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package test;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.NativeLong;
|
||||
import com.sun.jna.examples.win32.W32API.HWND;
|
||||
|
||||
import test.HCNetSDK;
|
||||
|
||||
import java.awt.Panel;
|
||||
|
||||
import javax.swing.GroupLayout;
|
||||
import javax.swing.GroupLayout.Alignment;
|
||||
import java.awt.Color;
|
||||
import java.awt.event.FocusAdapter;
|
||||
import java.awt.event.FocusEvent;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
public class Show extends JPanel
|
||||
{
|
||||
static HCNetSDK hCNetSDK = HCNetSDK.INSTANCE;
|
||||
private boolean m_isPlaying;
|
||||
private boolean m_isFocus;
|
||||
private NativeLong m_lLogID;//logID
|
||||
private NativeLong m_lPreviewHandle; //priview handle
|
||||
private NativeLong m_lChannelNum; //channel num
|
||||
|
||||
private java.awt.Panel panelPlay;
|
||||
public Show() {
|
||||
setLayout(null);
|
||||
|
||||
Panel panel = new Panel();
|
||||
panel.setBounds(224, 5, 1, 1);
|
||||
add(panel);
|
||||
panel.setLayout(null);
|
||||
|
||||
panelPlay = new Panel();
|
||||
panelPlay.addFocusListener(new FocusAdapter() {
|
||||
@Override
|
||||
public void focusGained(FocusEvent e) {
|
||||
m_isFocus=true;
|
||||
panelPlay.setBackground(Color.lightGray);
|
||||
}
|
||||
@Override
|
||||
public void focusLost(FocusEvent e) {
|
||||
m_isFocus=false;
|
||||
panelPlay.setBackground(Color.white);
|
||||
}
|
||||
});
|
||||
panelPlay.setBackground(Color.WHITE);
|
||||
panelPlay.setBounds(10, 5, 428, 266);
|
||||
add(panelPlay);
|
||||
GroupLayout gl_panelPlay = new GroupLayout(panelPlay);
|
||||
gl_panelPlay.setHorizontalGroup(
|
||||
gl_panelPlay.createParallelGroup(Alignment.LEADING)
|
||||
.addGap(0, 838, Short.MAX_VALUE)
|
||||
);
|
||||
gl_panelPlay.setVerticalGroup(
|
||||
gl_panelPlay.createParallelGroup(Alignment.LEADING)
|
||||
.addGap(0, 447, Short.MAX_VALUE)
|
||||
);
|
||||
panelPlay.setLayout(gl_panelPlay);
|
||||
m_isPlaying=false;
|
||||
m_isFocus=false;
|
||||
m_lChannelNum = new NativeLong(-1);
|
||||
m_lLogID = new NativeLong(-1);
|
||||
}
|
||||
|
||||
void StopPlay()
|
||||
{
|
||||
if (m_isPlaying)
|
||||
{
|
||||
hCNetSDK.NET_DVR_StopRealPlay(m_lPreviewHandle);
|
||||
panelPlay.repaint();
|
||||
m_isPlaying = false;
|
||||
}
|
||||
}
|
||||
void StartPlay(NativeLong lUserId,HCNetSDK.NET_DVR_PREVIEWINFO struPreviewInfo)
|
||||
{
|
||||
if(m_isPlaying)
|
||||
{
|
||||
StopPlay();
|
||||
}
|
||||
m_lLogID=lUserId;
|
||||
m_isPlaying=true;
|
||||
HWND hwnd = new HWND(Native.getComponentPointer(panelPlay));
|
||||
struPreviewInfo.hPlayWnd = hwnd;
|
||||
m_lChannelNum = struPreviewInfo.lChannel;
|
||||
m_lPreviewHandle = hCNetSDK.NET_DVR_RealPlay_V40(lUserId, struPreviewInfo, null, null);
|
||||
}
|
||||
|
||||
boolean GetFocus()
|
||||
{
|
||||
return m_isFocus;
|
||||
}
|
||||
|
||||
void SetFocus()
|
||||
{
|
||||
m_isFocus = true;
|
||||
panelPlay.setBackground(Color.lightGray);
|
||||
}
|
||||
|
||||
NativeLong GetID()
|
||||
{
|
||||
return m_lLogID;
|
||||
}
|
||||
|
||||
boolean GetIsPlaying()
|
||||
{
|
||||
return m_isPlaying;
|
||||
}
|
||||
|
||||
NativeLong GetPreviewHanedle()
|
||||
{
|
||||
return m_lPreviewHandle;
|
||||
}
|
||||
|
||||
NativeLong GetChannelNum()
|
||||
{
|
||||
return m_lChannelNum;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,347 @@
|
||||
package test;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
import com.sun.jna.NativeLong;
|
||||
import com.sun.jna.Pointer;
|
||||
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
import java.awt.event.ItemEvent;
|
||||
|
||||
public class TransparentChannelCfg extends JDialog {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
static HCNetSDK hCNetSDK = HCNetSDK.INSTANCE;
|
||||
private NativeLong m_lUserID;
|
||||
private NativeLong m_lSerialHandle = new NativeLong(-1);
|
||||
|
||||
private JTextField m_textFieldSerialNumber;
|
||||
private JTextField m_textFieldSendData;
|
||||
private JTable m_tableReceiveContent;
|
||||
JComboBox<String> m_cmbChannelNumber;
|
||||
private String[] m_sChannelNumber_232 = {"Serial1", "Serial2"};
|
||||
private String[] m_sChannelNumber_485 = {"Channel1"};
|
||||
private HCNetSDK.NET_DVR_SERIALSTART_V40 m_sSerialStart_V40 = new HCNetSDK.NET_DVR_SERIALSTART_V40();
|
||||
private int m_iSelectSendCommand;
|
||||
|
||||
/**
|
||||
* Create the panel.
|
||||
*/
|
||||
public TransparentChannelCfg(NativeLong lUserID) {
|
||||
setTitle("Serial Trans");
|
||||
getContentPane().setLayout(null);
|
||||
m_lUserID = lUserID;
|
||||
|
||||
this.addWindowListener(new WindowAdapter()
|
||||
{
|
||||
@Override
|
||||
public void windowClosing(WindowEvent e)
|
||||
{
|
||||
if (-1 == m_lSerialHandle.longValue())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (false == hCNetSDK.NET_DVR_SerialStop(m_lSerialHandle))
|
||||
{
|
||||
int iErr = hCNetSDK.NET_DVR_GetLastError();
|
||||
DialogMessage dlg = new DialogMessage("stop direct transmission failed,error code is: "+iErr);
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_lSerialHandle = new NativeLong(-1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
JLabel lblSerialType = new JLabel("Serial Type");
|
||||
lblSerialType.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblSerialType.setBounds(37, 24, 99, 15);
|
||||
getContentPane().add(lblSerialType);
|
||||
|
||||
JLabel lblChannelNumber = new JLabel("Channel Number");
|
||||
lblChannelNumber.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblChannelNumber.setBounds(238, 24, 99, 15);
|
||||
getContentPane().add(lblChannelNumber);
|
||||
|
||||
JLabel lblSerialNumber = new JLabel("Serial Number");
|
||||
lblSerialNumber.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblSerialNumber.setBounds(450, 24, 99, 15);
|
||||
getContentPane().add(lblSerialNumber);
|
||||
|
||||
final JComboBox<String> cmbSerialType = new JComboBox<String>();
|
||||
cmbSerialType.addItemListener(new ItemListener() {
|
||||
public void itemStateChanged(ItemEvent arg0) {
|
||||
String strSerialType = (String)cmbSerialType.getSelectedItem();
|
||||
switch (strSerialType) {
|
||||
case "232":
|
||||
m_sSerialStart_V40.read();
|
||||
m_sSerialStart_V40.dwSerialType = 1;
|
||||
m_sSerialStart_V40.write();
|
||||
m_cmbChannelNumber.setModel(new DefaultComboBoxModel<String>(m_sChannelNumber_232));
|
||||
break;
|
||||
case "485":
|
||||
m_sSerialStart_V40.read();
|
||||
m_sSerialStart_V40.dwSerialType = 2;
|
||||
m_sSerialStart_V40.write();
|
||||
m_cmbChannelNumber.setModel(new DefaultComboBoxModel<String>(m_sChannelNumber_485));
|
||||
break;
|
||||
default:
|
||||
DialogMessage dlg = new DialogMessage("select send command failed!");
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
String[] sSerialType = {"232", "485"};
|
||||
cmbSerialType.setModel(new DefaultComboBoxModel<String>(sSerialType));
|
||||
cmbSerialType.setSelectedItem(sSerialType[0]);
|
||||
cmbSerialType.setBounds(135, 21, 93, 21);
|
||||
getContentPane().add(cmbSerialType);
|
||||
|
||||
m_cmbChannelNumber = new JComboBox<String>();
|
||||
String[] sChannelNumber = {"Serial1", "Serial2"};
|
||||
m_cmbChannelNumber.setSelectedItem(sChannelNumber[0]);
|
||||
m_cmbChannelNumber.setModel(new DefaultComboBoxModel<String>(sChannelNumber));
|
||||
m_cmbChannelNumber.setBounds(347, 21, 93, 21);
|
||||
getContentPane().add(m_cmbChannelNumber);
|
||||
|
||||
m_textFieldSerialNumber = new JTextField();
|
||||
m_textFieldSerialNumber.setText("0");
|
||||
m_textFieldSerialNumber.setColumns(10);
|
||||
m_textFieldSerialNumber.setBounds(552, 21, 86, 21);
|
||||
getContentPane().add(m_textFieldSerialNumber);
|
||||
|
||||
JLabel lblSendData = new JLabel("Send Data");
|
||||
lblSendData.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblSendData.setBounds(37, 72, 99, 15);
|
||||
getContentPane().add(lblSendData);
|
||||
|
||||
JLabel lblSendInterface = new JLabel("Send Interface");
|
||||
lblSendInterface.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblSendInterface.setBounds(37, 116, 99, 15);
|
||||
getContentPane().add(lblSendInterface);
|
||||
|
||||
m_textFieldSendData = new JTextField();
|
||||
m_textFieldSendData.setColumns(10);
|
||||
m_textFieldSendData.setBounds(135, 69, 503, 21);
|
||||
getContentPane().add(m_textFieldSendData);
|
||||
|
||||
m_iSelectSendCommand = 1;
|
||||
final JComboBox<String> cmbSendInterface = new JComboBox<String>();
|
||||
cmbSendInterface.addItemListener(new ItemListener() {
|
||||
public void itemStateChanged(ItemEvent arg0) {
|
||||
String strSendInterface = (String)cmbSendInterface.getSelectedItem();
|
||||
switch (strSendInterface) {
|
||||
case "NET_DVR_SerialSend(Transparent)":
|
||||
m_iSelectSendCommand = 1;
|
||||
break;
|
||||
case "NET_DVR_SendToSerialPort(direct)":
|
||||
m_iSelectSendCommand = 2;
|
||||
break;
|
||||
case "NET_DVR_SendTo232Port(direct)":
|
||||
m_iSelectSendCommand = 3;
|
||||
break;
|
||||
default:
|
||||
DialogMessage dlg = new DialogMessage("select send command failed!");
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
String[] sSendInterface = {"NET_DVR_SerialSend(Transparent)", "NET_DVR_SendToSerialPort(direct)", "NET_DVR_SendTo232Port(direct)"};
|
||||
cmbSendInterface.setSelectedItem(sSendInterface[0]);
|
||||
cmbSendInterface.setModel(new DefaultComboBoxModel<String>(sSendInterface));
|
||||
cmbSendInterface.setBounds(135, 113, 250, 21);
|
||||
getContentPane().add(cmbSendInterface);
|
||||
|
||||
JButton btnSend = new JButton("Send");
|
||||
btnSend.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
String sSendData = m_textFieldSendData.getText();
|
||||
if (sSendData.length() > 1016)
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("please send data less than 1016!");
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
DialogMessage dlg;
|
||||
switch (m_iSelectSendCommand) {
|
||||
case 1:
|
||||
if (-1 == m_lSerialHandle.longValue())
|
||||
{
|
||||
dlg = new DialogMessage("please start direct transmission first!");
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
if (false == hCNetSDK.NET_DVR_SerialSend(m_lSerialHandle, new NativeLong(1), sSendData, sSendData.length()))
|
||||
{
|
||||
int iErr = hCNetSDK.NET_DVR_GetLastError();
|
||||
dlg = new DialogMessage("send data failed,error code is: "+iErr);
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
if (false == hCNetSDK.NET_DVR_SendToSerialPort(m_lUserID, 1, 1, sSendData, sSendData.length()))
|
||||
{
|
||||
int iErr = hCNetSDK.NET_DVR_GetLastError();
|
||||
dlg = new DialogMessage("send data failed,error code is: "+iErr);
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (false == hCNetSDK.NET_DVR_SendTo232Port(m_lUserID, sSendData, sSendData.length()))
|
||||
{
|
||||
int iErr = hCNetSDK.NET_DVR_GetLastError();
|
||||
dlg = new DialogMessage("send data failed,error code is: "+iErr);
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
dlg = new DialogMessage("select send data command failed!");
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
break;
|
||||
}
|
||||
dlg = new DialogMessage("send data succeed!");
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
});
|
||||
btnSend.setBounds(527, 112, 111, 23);
|
||||
getContentPane().add(btnSend);
|
||||
|
||||
JLabel lblReceiveContent = new JLabel("Receive Content");
|
||||
lblReceiveContent.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
lblReceiveContent.setBounds(37, 159, 99, 15);
|
||||
getContentPane().add(lblReceiveContent);
|
||||
|
||||
m_tableReceiveContent = new JTable();
|
||||
m_tableReceiveContent.setModel(new DefaultTableModel(
|
||||
new Object[][] {
|
||||
{"Time", "Content", "Hex"},
|
||||
{null, null, null},
|
||||
{null, null, null},
|
||||
{null, null, null},
|
||||
{null, null, null},
|
||||
{null, null, null},
|
||||
{null, null, null},
|
||||
{null, null, null},
|
||||
{null, null, null},
|
||||
{null, null, null},
|
||||
{null, null, null},
|
||||
},
|
||||
new String[] {
|
||||
"Time", "Content", "Hex"
|
||||
}
|
||||
));
|
||||
m_tableReceiveContent.setBounds(63, 201, 592, 144);
|
||||
getContentPane().add(m_tableReceiveContent);
|
||||
|
||||
JButton btnBuildChannel = new JButton("Build Channel");
|
||||
m_sSerialStart_V40.dwSerialType = 1; // 1-232; 2-485
|
||||
btnBuildChannel.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
if (-1 != m_lSerialHandle.longValue())
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("please stop direct transmission first!");
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
long lUserID = m_lUserID.longValue();
|
||||
if (-1 == lUserID)
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("please login at first!");
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
m_sSerialStart_V40.dwSize = m_sSerialStart_V40.size();
|
||||
//m_sSerialStart_V40.dwSerialType = 1; // 1-232; 2-485
|
||||
m_sSerialStart_V40.bySerialNum = 0;
|
||||
m_sSerialStart_V40.write();
|
||||
Pointer lpSerialStart_V40 = m_sSerialStart_V40.getPointer();
|
||||
m_lSerialHandle = hCNetSDK.NET_DVR_SerialStart_V40(m_lUserID, lpSerialStart_V40, new NativeLong(m_sSerialStart_V40.size()), null, null);
|
||||
m_sSerialStart_V40.read();
|
||||
long lSerialHandle = m_lSerialHandle.longValue();
|
||||
if (-1 == lSerialHandle)
|
||||
{
|
||||
int iErr = hCNetSDK.NET_DVR_GetLastError();
|
||||
DialogMessage dlg = new DialogMessage("start direct transmission failed,error code is: "+iErr);
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("start direct transmission succeed!");
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
btnBuildChannel.setBounds(406, 378, 111, 23);
|
||||
getContentPane().add(btnBuildChannel);
|
||||
|
||||
JButton btnStopChannel = new JButton("Stop Channel");
|
||||
btnStopChannel.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent arg0) {
|
||||
if (-1 == m_lSerialHandle.longValue())
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("direct transmission has been stopped!");
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
if (false == hCNetSDK.NET_DVR_SerialStop(m_lSerialHandle))
|
||||
{
|
||||
int iErr = hCNetSDK.NET_DVR_GetLastError();
|
||||
DialogMessage dlg = new DialogMessage("stop direct transmission failed,error code is: "+iErr);
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_lSerialHandle = new NativeLong(-1);
|
||||
DialogMessage dlg = new DialogMessage("stop direct transmission succeed");
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
btnStopChannel.setBounds(527, 378, 111, 23);
|
||||
getContentPane().add(btnStopChannel);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,680 @@
|
||||
package test;
|
||||
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.JComboBox;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.DefaultComboBoxModel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JSlider;
|
||||
import javax.swing.JButton;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
|
||||
import com.sun.jna.NativeLong;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.awt.event.ItemEvent;
|
||||
|
||||
public class VideoCfg extends JDialog {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
static HCNetSDK hCNetSDK = HCNetSDK.INSTANCE;
|
||||
private NativeLong m_lUserID;
|
||||
|
||||
private NET_DVR_MULTI_STREAM_COMPRESSIONCFG_COND_4 m_struMultiStreamCompressionCond = new NET_DVR_MULTI_STREAM_COMPRESSIONCFG_COND_4();
|
||||
private NET_DVR_MULTI_STREAM_COMPRESSIONCFG_4 m_struMultiStreamCompressionCfg = new NET_DVR_MULTI_STREAM_COMPRESSIONCFG_4();
|
||||
private STATUS_LIST_4 m_struStatusList = new STATUS_LIST_4();
|
||||
private COMPRESSION_INFO_LOCAL m_struCompressionInfoLocal = new COMPRESSION_INFO_LOCAL();
|
||||
|
||||
private JComboBox<String> m_cmbStreamType;
|
||||
private String[] m_sStreamType = {"Main Stream (Timing)", "Sub Stream (Net)", "Event Stream", "Third Stream"};
|
||||
private JComboBox<String> m_cmbVideoType;
|
||||
private String[] m_sVideoType = {"Video Stream", "Compound Stream", "Auto"};
|
||||
private JComboBox<String> m_cmbResolution;
|
||||
private String[] m_sResolution = {"DCIF(528*384/528*320)", "CIF(352*288/352*240)", "QCIF(176*144/176*120)", "4CIF(704*576/704*480)", "2CIF(704*288/704*240)", "QVGA(320*240)", "QQVGA(160*120)", "384*288", "576*576", "VGA(640*480)", "UXGA(1600*1200)", "SVGA(800*600)", "HD720P(1280*720)", "XVGA(1280*960)", "HD900P(1600*900)", "1360*1024", "1536*1536", "1920*1920", "1920*1080", "2560*1920", "1600*304", "2048*1536", "2448*2048", "2448*1200", "2448*800", "XGA(1024*768)", "SXGA(1280*1024)", "WD1(960*576/960*480)", "1080i(1920*1080)", "WXGA(1440*900)", "HD_F(1920*1080/1280*720)", "HD_H(1920*540/1280*360)", "HD_Q(960*540/630*360)", "2336*1744", "1920*1456", "2592*2048", "3296*2472", "1376*768", "1366*768", "1360*768", "WSXGA+", "720*720", "1280*1280", "2048*768", "2048*2048", "2560*2048", "3072*2048", "2304*1296", "WXGA(1280*800)", "1600*600", "1600*900", "2752*2208", "384*288", "4000*3000", "4096*2160", "3840*2160", "4000*2250", "3072*1728", "2592*1944", "2464*1520", "1280*1920", "2560*1440", "1024*1024", "160*128", "324*240", "324*256", "336*256", "640*512", "2720*2048", "384*256", "384*216", "320*256", "320*180", "320*192", "512*384", "325*256", "256*192", "640*360", "Auto"};
|
||||
private JComboBox<String> m_cmbRateType;
|
||||
private String[] m_sRateType = {"Variable Rate", "Constant Rate"};
|
||||
private JComboBox<String> m_cmbImageQuality;
|
||||
private String[] m_sImageQuality = {"Highest", "Higher", "High", "Medium", "Low", "Lower", "Auto"};
|
||||
private JComboBox<String> m_cmbVideoBitrate;
|
||||
private String[] m_sVideoBitrate = {"32K", "48K", "64K", "80K", "96K", "128K", "160k", "192K", "224K", "256K", "320K", "384K", "448K", "512K", "640K", "768K", "896K", "1024K", "1280K", "1536K", "1792K", "2048K", "3072K", "4096K", "8192K", "16384K", "Auto"};
|
||||
private JComboBox<String> m_cmbVideoFrameRate;
|
||||
private String[] m_sVidemoFrameRate = {"All", "1/16", "1/8", "1/4", "1/2", "1", "2", "4", "6", "8", "10", "12", "16", "20", "15", "18", "22", "25", "30", "35", "40", "45", "50", "55", "60", "3", "5", "7", "9", "100", "120", "24", "48", "Auto"};
|
||||
private JComboBox<String> m_cmbIntervalBPFrame;
|
||||
private String[] m_sIntervalBPFrame = {"BBP Frame", "BP Frame", "P Frame"};
|
||||
private JComboBox<String> m_cmbVideoEncType;
|
||||
private String[] m_sVideoEncType = {"Private 264", "Standard h264", "Standard mpeg4", "M-JPEG", "MPEG2", "SVAC", "Standard h265", "Auto"};
|
||||
private JComboBox<String> m_cmbVideoEncComplexity;
|
||||
private String[] m_sVideoEncComplexity = {"Low", "Medium", "High", "Auto"};
|
||||
private JSlider m_slider;
|
||||
private JComboBox<String> m_cmbEnableSvc;
|
||||
private String [] m_sEnableSvc = {"Disable", "Enable", "Auto"};
|
||||
private JComboBox<String> m_cmbFormatType;
|
||||
private String [] m_sFormatType = {"Naked Stream", "RTP", "PS", "TS", "Private", "FLV", "ASF", "3GP", "RTP+PS"};
|
||||
private JTextField m_textFieldStreamSmoothing;
|
||||
private String m_sPreStreamType;
|
||||
private String m_sCurStreamType;
|
||||
|
||||
/**
|
||||
* Create the panel.
|
||||
*/
|
||||
public VideoCfg(NativeLong lUserID) {
|
||||
setTitle("Video Configure");
|
||||
InitVideoCfg();
|
||||
getContentPane().setLayout(null);
|
||||
m_lUserID = lUserID;
|
||||
|
||||
JLabel lblStreamType = new JLabel("Stream Type");
|
||||
lblStreamType.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblStreamType.setBounds(62, 24, 131, 15);
|
||||
getContentPane().add(lblStreamType);
|
||||
|
||||
JLabel lblVideoType = new JLabel("Video Type");
|
||||
lblVideoType.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblVideoType.setBounds(62, 54, 131, 15);
|
||||
getContentPane().add(lblVideoType);
|
||||
|
||||
JLabel lblResolution = new JLabel("Resolution");
|
||||
lblResolution.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblResolution.setBounds(62, 84, 131, 15);
|
||||
getContentPane().add(lblResolution);
|
||||
|
||||
JLabel lblRateType = new JLabel("Bitrate Type");
|
||||
lblRateType.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblRateType.setBounds(62, 114, 131, 15);
|
||||
getContentPane().add(lblRateType);
|
||||
|
||||
JLabel lblPicQuality = new JLabel("Pic Quality");
|
||||
lblPicQuality.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblPicQuality.setBounds(62, 144, 131, 15);
|
||||
getContentPane().add(lblPicQuality);
|
||||
|
||||
JLabel lblVideoBitrate = new JLabel("Video Bitrate");
|
||||
lblVideoBitrate.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblVideoBitrate.setBounds(62, 174, 131, 15);
|
||||
getContentPane().add(lblVideoBitrate);
|
||||
|
||||
JLabel lblVideoFrameRate = new JLabel("Video Frame Rate");
|
||||
lblVideoFrameRate.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblVideoFrameRate.setBounds(62, 205, 131, 15);
|
||||
getContentPane().add(lblVideoFrameRate);
|
||||
|
||||
JLabel lblIntervalBPFrame = new JLabel("Interval BP Frame");
|
||||
lblIntervalBPFrame.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblIntervalBPFrame.setBounds(62, 236, 131, 15);
|
||||
getContentPane().add(lblIntervalBPFrame);
|
||||
|
||||
JLabel lblVideoEncType = new JLabel("Video EncType");
|
||||
lblVideoEncType.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblVideoEncType.setBounds(62, 268, 131, 15);
|
||||
getContentPane().add(lblVideoEncType);
|
||||
|
||||
JLabel lblVideoEncComplexity = new JLabel("Video Enc Complexity");
|
||||
lblVideoEncComplexity.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblVideoEncComplexity.setBounds(62, 296, 131, 15);
|
||||
getContentPane().add(lblVideoEncComplexity);
|
||||
|
||||
JLabel lblEnableSvc = new JLabel("Enable Svc");
|
||||
lblEnableSvc.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblEnableSvc.setBounds(62, 325, 131, 15);
|
||||
getContentPane().add(lblEnableSvc);
|
||||
|
||||
JLabel lblFormatType = new JLabel("Format Type");
|
||||
lblFormatType.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblFormatType.setBounds(62, 356, 131, 15);
|
||||
getContentPane().add(lblFormatType);
|
||||
|
||||
JLabel lblStreamSmooth = new JLabel("Stream Smooth");
|
||||
lblStreamSmooth.setHorizontalAlignment(SwingConstants.RIGHT);
|
||||
lblStreamSmooth.setBounds(62, 388, 131, 15);
|
||||
getContentPane().add(lblStreamSmooth);
|
||||
|
||||
m_cmbStreamType = new JComboBox<String>();
|
||||
m_cmbStreamType.addItemListener(new ItemListener() {
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
if (ItemEvent.SELECTED == e.getStateChange())
|
||||
{
|
||||
m_sCurStreamType = (String)m_cmbStreamType.getSelectedItem();
|
||||
SetStreamType(m_sPreStreamType);
|
||||
StreamTypeChanged(m_sCurStreamType);
|
||||
m_sPreStreamType = m_sCurStreamType;
|
||||
}
|
||||
}
|
||||
});
|
||||
m_cmbStreamType.setModel(new DefaultComboBoxModel<String>(m_sStreamType));
|
||||
m_cmbStreamType.setBounds(240, 21, 177, 21);
|
||||
getContentPane().add(m_cmbStreamType);
|
||||
|
||||
m_cmbVideoType = new JComboBox<String>();
|
||||
m_cmbVideoType.setModel(new DefaultComboBoxModel<String>(m_sVideoType));
|
||||
m_cmbVideoType.setBounds(240, 51, 177, 21);
|
||||
getContentPane().add(m_cmbVideoType);
|
||||
|
||||
m_cmbResolution = new JComboBox<String>();
|
||||
m_cmbResolution.setModel(new DefaultComboBoxModel<String>(m_sResolution));
|
||||
m_cmbResolution.setBounds(240, 81, 177, 21);
|
||||
getContentPane().add(m_cmbResolution);
|
||||
|
||||
m_cmbRateType = new JComboBox<String>();
|
||||
m_cmbRateType.setModel(new DefaultComboBoxModel<String>(m_sRateType));
|
||||
m_cmbRateType.setBounds(240, 111, 177, 21);
|
||||
getContentPane().add(m_cmbRateType);
|
||||
|
||||
m_cmbImageQuality = new JComboBox<String>();
|
||||
m_cmbImageQuality.setModel(new DefaultComboBoxModel<String>(m_sImageQuality));
|
||||
m_cmbImageQuality.setBounds(240, 141, 177, 21);
|
||||
getContentPane().add(m_cmbImageQuality);
|
||||
|
||||
m_cmbVideoBitrate = new JComboBox<String>();
|
||||
m_cmbVideoBitrate.setModel(new DefaultComboBoxModel<String>(m_sVideoBitrate));
|
||||
m_cmbVideoBitrate.setBounds(240, 171, 177, 21);
|
||||
getContentPane().add(m_cmbVideoBitrate);
|
||||
|
||||
m_cmbVideoFrameRate = new JComboBox<String>();
|
||||
m_cmbVideoFrameRate.setModel(new DefaultComboBoxModel<String>(m_sVidemoFrameRate));
|
||||
m_cmbVideoFrameRate.setBounds(240, 202, 177, 21);
|
||||
getContentPane().add(m_cmbVideoFrameRate);
|
||||
|
||||
m_cmbIntervalBPFrame = new JComboBox<String>();
|
||||
m_cmbIntervalBPFrame.setModel(new DefaultComboBoxModel<String>(m_sIntervalBPFrame));
|
||||
m_cmbIntervalBPFrame.setBounds(240, 233, 177, 21);
|
||||
getContentPane().add(m_cmbIntervalBPFrame);
|
||||
|
||||
m_cmbVideoEncType = new JComboBox<String>();
|
||||
m_cmbVideoEncType.setModel(new DefaultComboBoxModel<String>(m_sVideoEncType));
|
||||
m_cmbVideoEncType.setBounds(240, 265, 177, 21);
|
||||
getContentPane().add(m_cmbVideoEncType);
|
||||
|
||||
m_cmbVideoEncComplexity = new JComboBox<String>();
|
||||
m_cmbVideoEncComplexity.setModel(new DefaultComboBoxModel<String>(m_sVideoEncComplexity));
|
||||
m_cmbVideoEncComplexity.setBounds(240, 293, 177, 21);
|
||||
getContentPane().add(m_cmbVideoEncComplexity);
|
||||
|
||||
m_slider = new JSlider();
|
||||
m_slider.addChangeListener(new ChangeListener() {
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
if ((JSlider)e.getSource() == m_slider)
|
||||
{
|
||||
m_textFieldStreamSmoothing.setText(""+m_slider.getValue());
|
||||
}
|
||||
}
|
||||
});
|
||||
m_slider.setBounds(240, 388, 177, 23);
|
||||
getContentPane().add(m_slider);
|
||||
|
||||
m_cmbEnableSvc = new JComboBox<String>();
|
||||
m_cmbEnableSvc.setModel(new DefaultComboBoxModel<String>(m_sEnableSvc));
|
||||
m_cmbEnableSvc.setBounds(240, 322, 177, 21);
|
||||
getContentPane().add(m_cmbEnableSvc);
|
||||
|
||||
m_cmbFormatType = new JComboBox<String>();
|
||||
m_cmbFormatType.setModel(new DefaultComboBoxModel<String>(m_sFormatType));
|
||||
m_cmbFormatType.setBounds(240, 353, 177, 21);
|
||||
getContentPane().add(m_cmbFormatType);
|
||||
|
||||
m_textFieldStreamSmoothing = new JTextField();
|
||||
m_textFieldStreamSmoothing.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
m_textFieldStreamSmoothing.setText("50");
|
||||
m_textFieldStreamSmoothing.setColumns(10);
|
||||
m_textFieldStreamSmoothing.setBounds(427, 385, 32, 21);
|
||||
m_textFieldStreamSmoothing.setEditable(false);
|
||||
getContentPane().add(m_textFieldStreamSmoothing);
|
||||
|
||||
JLabel lblClearToSmooth = new JLabel("Clear<—>Smooth");
|
||||
lblClearToSmooth.setHorizontalAlignment(SwingConstants.LEFT);
|
||||
lblClearToSmooth.setBounds(469, 388, 115, 15);
|
||||
getContentPane().add(lblClearToSmooth);
|
||||
|
||||
JButton btnGet = new JButton("Get");
|
||||
btnGet.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Pointer lpMultiStreamCompressionCond = m_struMultiStreamCompressionCond.getPointer();
|
||||
Pointer lpMultiStreamCompressionCfg = m_struMultiStreamCompressionCfg.getPointer();
|
||||
Pointer lpStatusList = m_struStatusList.getPointer();
|
||||
|
||||
m_struMultiStreamCompressionCond.write();
|
||||
m_struMultiStreamCompressionCfg.write();
|
||||
m_struStatusList.write();
|
||||
if (false == hCNetSDK.NET_DVR_GetDeviceConfig(m_lUserID, HCNetSDK.NET_DVR_GET_MULTI_STREAM_COMPRESSIONCFG, 4, lpMultiStreamCompressionCond, m_struMultiStreamCompressionCond.size(), lpStatusList, lpMultiStreamCompressionCfg, m_struMultiStreamCompressionCfg.size()))
|
||||
{
|
||||
int iErr = hCNetSDK.NET_DVR_GetLastError();
|
||||
DialogMessage dlg = new DialogMessage("get failed,error code is: "+iErr);
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("get succeed!");
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
m_struMultiStreamCompressionCond.read();
|
||||
m_struMultiStreamCompressionCfg.read();
|
||||
m_struStatusList.read();
|
||||
|
||||
m_sCurStreamType = m_sPreStreamType = (String)m_cmbStreamType.getSelectedItem();
|
||||
StreamTypeChanged(m_sCurStreamType);
|
||||
}
|
||||
});
|
||||
btnGet.setBounds(111, 441, 82, 23);
|
||||
getContentPane().add(btnGet);
|
||||
|
||||
JButton btnSet = new JButton("Set");
|
||||
btnSet.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
SetStreamType(m_sCurStreamType);
|
||||
|
||||
Pointer lpMultiStreamCompressionCond = m_struMultiStreamCompressionCond.getPointer();
|
||||
Pointer lpMultiStreamCompressionCfg = m_struMultiStreamCompressionCfg.getPointer();
|
||||
Pointer lpStatusList = m_struStatusList.getPointer();
|
||||
|
||||
m_struMultiStreamCompressionCond.write();
|
||||
m_struMultiStreamCompressionCfg.write();
|
||||
m_struStatusList.write();
|
||||
if (false == hCNetSDK.NET_DVR_SetDeviceConfig(m_lUserID, HCNetSDK.NET_DVR_SET_MULTI_STREAM_COMPRESSIONCFG, 4, lpMultiStreamCompressionCond, m_struMultiStreamCompressionCond.size(), lpStatusList, lpMultiStreamCompressionCfg, m_struMultiStreamCompressionCfg.size()))
|
||||
{
|
||||
int iErr = hCNetSDK.NET_DVR_GetLastError();
|
||||
DialogMessage dlg = new DialogMessage("set failed,error code is: "+iErr);
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogMessage dlg = new DialogMessage("set succeed!");
|
||||
dlg.setBounds(dlg.getX()+dlg.getWidth()/2,dlg.getY()+dlg.getHeight() , 370, 200);
|
||||
dlg.setVisible(true);
|
||||
}
|
||||
m_struMultiStreamCompressionCond.read();
|
||||
m_struMultiStreamCompressionCfg.read();
|
||||
m_struStatusList.read();
|
||||
|
||||
}
|
||||
});
|
||||
btnSet.setBounds(335, 441, 82, 23);
|
||||
getContentPane().add(btnSet);
|
||||
|
||||
}
|
||||
|
||||
private void InitVideoCfg()
|
||||
{
|
||||
m_struMultiStreamCompressionCond.struMultiStreamCompressionCond1.dwSize = m_struMultiStreamCompressionCond.struMultiStreamCompressionCond1.size();
|
||||
m_struMultiStreamCompressionCond.struMultiStreamCompressionCond2.dwSize = m_struMultiStreamCompressionCond.struMultiStreamCompressionCond2.size();
|
||||
m_struMultiStreamCompressionCond.struMultiStreamCompressionCond3.dwSize = m_struMultiStreamCompressionCond.struMultiStreamCompressionCond3.size();
|
||||
m_struMultiStreamCompressionCond.struMultiStreamCompressionCond4.dwSize = m_struMultiStreamCompressionCond.struMultiStreamCompressionCond4.size();
|
||||
m_struMultiStreamCompressionCond.struMultiStreamCompressionCond1.struStreamInfo.dwSize = m_struMultiStreamCompressionCond.struMultiStreamCompressionCond1.struStreamInfo.size();
|
||||
m_struMultiStreamCompressionCond.struMultiStreamCompressionCond2.struStreamInfo.dwSize = m_struMultiStreamCompressionCond.struMultiStreamCompressionCond1.struStreamInfo.size();
|
||||
m_struMultiStreamCompressionCond.struMultiStreamCompressionCond3.struStreamInfo.dwSize = m_struMultiStreamCompressionCond.struMultiStreamCompressionCond1.struStreamInfo.size();
|
||||
m_struMultiStreamCompressionCond.struMultiStreamCompressionCond4.struStreamInfo.dwSize = m_struMultiStreamCompressionCond.struMultiStreamCompressionCond1.struStreamInfo.size();
|
||||
m_struMultiStreamCompressionCond.struMultiStreamCompressionCond1.struStreamInfo.dwChannel = 1;
|
||||
m_struMultiStreamCompressionCond.struMultiStreamCompressionCond2.struStreamInfo.dwChannel = 1;
|
||||
m_struMultiStreamCompressionCond.struMultiStreamCompressionCond3.struStreamInfo.dwChannel = 1;
|
||||
m_struMultiStreamCompressionCond.struMultiStreamCompressionCond4.struStreamInfo.dwChannel = 1;
|
||||
m_struMultiStreamCompressionCond.struMultiStreamCompressionCond1.dwStreamType = 0;
|
||||
m_struMultiStreamCompressionCond.struMultiStreamCompressionCond2.dwStreamType = 1;
|
||||
m_struMultiStreamCompressionCond.struMultiStreamCompressionCond3.dwStreamType = 2;
|
||||
m_struMultiStreamCompressionCond.struMultiStreamCompressionCond4.dwStreamType = 3;
|
||||
|
||||
m_struMultiStreamCompressionCfg.struMultiStreamCompressionCfg1.dwSize = m_struMultiStreamCompressionCfg.struMultiStreamCompressionCfg1.size();
|
||||
m_struMultiStreamCompressionCfg.struMultiStreamCompressionCfg2.dwSize = m_struMultiStreamCompressionCfg.struMultiStreamCompressionCfg2.size();
|
||||
m_struMultiStreamCompressionCfg.struMultiStreamCompressionCfg3.dwSize = m_struMultiStreamCompressionCfg.struMultiStreamCompressionCfg3.size();
|
||||
m_struMultiStreamCompressionCfg.struMultiStreamCompressionCfg4.dwSize = m_struMultiStreamCompressionCfg.struMultiStreamCompressionCfg4.size();
|
||||
}
|
||||
|
||||
public static class NET_DVR_MULTI_STREAM_COMPRESSIONCFG_COND_4 extends Structure{
|
||||
public HCNetSDK.NET_DVR_MULTI_STREAM_COMPRESSIONCFG_COND struMultiStreamCompressionCond1 = new HCNetSDK.NET_DVR_MULTI_STREAM_COMPRESSIONCFG_COND();
|
||||
public HCNetSDK.NET_DVR_MULTI_STREAM_COMPRESSIONCFG_COND struMultiStreamCompressionCond2 = new HCNetSDK.NET_DVR_MULTI_STREAM_COMPRESSIONCFG_COND();
|
||||
public HCNetSDK.NET_DVR_MULTI_STREAM_COMPRESSIONCFG_COND struMultiStreamCompressionCond3 = new HCNetSDK.NET_DVR_MULTI_STREAM_COMPRESSIONCFG_COND();
|
||||
public HCNetSDK.NET_DVR_MULTI_STREAM_COMPRESSIONCFG_COND struMultiStreamCompressionCond4 = new HCNetSDK.NET_DVR_MULTI_STREAM_COMPRESSIONCFG_COND();
|
||||
}
|
||||
public static class NET_DVR_MULTI_STREAM_COMPRESSIONCFG_4 extends Structure{
|
||||
public HCNetSDK.NET_DVR_MULTI_STREAM_COMPRESSIONCFG struMultiStreamCompressionCfg1 = new HCNetSDK.NET_DVR_MULTI_STREAM_COMPRESSIONCFG();
|
||||
public HCNetSDK.NET_DVR_MULTI_STREAM_COMPRESSIONCFG struMultiStreamCompressionCfg2 = new HCNetSDK.NET_DVR_MULTI_STREAM_COMPRESSIONCFG();
|
||||
public HCNetSDK.NET_DVR_MULTI_STREAM_COMPRESSIONCFG struMultiStreamCompressionCfg3 = new HCNetSDK.NET_DVR_MULTI_STREAM_COMPRESSIONCFG();
|
||||
public HCNetSDK.NET_DVR_MULTI_STREAM_COMPRESSIONCFG struMultiStreamCompressionCfg4 = new HCNetSDK.NET_DVR_MULTI_STREAM_COMPRESSIONCFG();
|
||||
}
|
||||
public static class STATUS_LIST_4 extends Structure{
|
||||
public int iStatusList1 = 0;
|
||||
public int iStatusList2 = 0;
|
||||
public int iStatusList3 = 0;
|
||||
public int iStatusList4 = 0;
|
||||
}
|
||||
public static class COMPRESSION_INFO_LOCAL extends Structure{
|
||||
public int iStreamType = 0;
|
||||
public int iResolution = 0;
|
||||
public int iBitrateType = 0;
|
||||
public int iPicQuality = 0;
|
||||
public int iVideoBitrate = 0;
|
||||
public int iVideoFrameRate = 0;
|
||||
public int iIntervalBPFrame = 0;
|
||||
public int iVideoEncType = 0;
|
||||
public int iVideoEncComplexity = 0;
|
||||
public int iEnableSvc = 0;
|
||||
public int iFormatType = 0;
|
||||
public int iSteamSmooth = 0;
|
||||
}
|
||||
|
||||
private void FindLocalCur(HCNetSDK.NET_DVR_COMPRESSION_INFO_V30 struCompressionInfo, COMPRESSION_INFO_LOCAL struCompressionInfoLocal)
|
||||
{
|
||||
// 1.StreamType
|
||||
if (0xfe == struCompressionInfo.byStreamType)
|
||||
{
|
||||
struCompressionInfoLocal.iStreamType = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
struCompressionInfoLocal.iStreamType = struCompressionInfo.byStreamType;
|
||||
}
|
||||
|
||||
// 2.Resolution
|
||||
if (struCompressionInfo.byResolution >= 0 && struCompressionInfo.byResolution <= 4)
|
||||
{
|
||||
struCompressionInfoLocal.iResolution = struCompressionInfo.byResolution;
|
||||
}
|
||||
else if (struCompressionInfo.byResolution >= 6 && struCompressionInfo.byResolution <= 7)
|
||||
{
|
||||
struCompressionInfoLocal.iResolution = struCompressionInfo.byResolution-1;
|
||||
}
|
||||
else if (struCompressionInfo.byResolution >= 12 && struCompressionInfo.byResolution <= 13)
|
||||
{
|
||||
struCompressionInfoLocal.iResolution = struCompressionInfo.byResolution-5;
|
||||
}
|
||||
else if (struCompressionInfo.byResolution >= 16 && struCompressionInfo.byResolution <= 24)
|
||||
{
|
||||
struCompressionInfoLocal.iResolution = struCompressionInfo.byResolution-7;
|
||||
}
|
||||
else if (struCompressionInfo.byResolution >= 27 && struCompressionInfo.byResolution <= 86)
|
||||
{
|
||||
struCompressionInfoLocal.iResolution = struCompressionInfo.byResolution-9;
|
||||
}
|
||||
else
|
||||
{
|
||||
struCompressionInfoLocal.iResolution = 78;
|
||||
}
|
||||
|
||||
// 3.BitrateType
|
||||
struCompressionInfoLocal.iBitrateType = struCompressionInfo.byBitrateType;
|
||||
|
||||
// 4.PicQuality
|
||||
if (0xfe == struCompressionInfo.byPicQuality)
|
||||
{
|
||||
struCompressionInfoLocal.iPicQuality = 6;
|
||||
}
|
||||
else
|
||||
{
|
||||
struCompressionInfoLocal.iPicQuality = struCompressionInfo.byPicQuality;
|
||||
}
|
||||
|
||||
// 5.VideoBitrate
|
||||
if (0xfffffffe == struCompressionInfo.dwVideoBitrate)
|
||||
{
|
||||
struCompressionInfoLocal.iVideoBitrate = 26;
|
||||
}
|
||||
else if (0 == struCompressionInfo.dwVideoBitrate)
|
||||
{
|
||||
struCompressionInfoLocal.iVideoBitrate = 26;
|
||||
}
|
||||
else
|
||||
{
|
||||
struCompressionInfoLocal.iVideoBitrate = struCompressionInfo.dwVideoBitrate-2;
|
||||
}
|
||||
|
||||
// 6.VideoFrameRate
|
||||
if (0xfffffffe == struCompressionInfo.dwVideoFrameRate)
|
||||
{
|
||||
struCompressionInfoLocal.iVideoFrameRate = 33;
|
||||
}
|
||||
else
|
||||
{
|
||||
struCompressionInfoLocal.iVideoFrameRate = struCompressionInfo.dwVideoFrameRate;
|
||||
}
|
||||
|
||||
// 7.IntervalBPFrame
|
||||
struCompressionInfoLocal.iIntervalBPFrame = struCompressionInfo.byIntervalBPFrame;
|
||||
|
||||
// 8.VideoEncType
|
||||
if (struCompressionInfo.byVideoEncType >= 0 && struCompressionInfo.byVideoEncType <= 2)
|
||||
{
|
||||
struCompressionInfoLocal.iVideoEncType = struCompressionInfo.byVideoEncType;
|
||||
}
|
||||
else if (struCompressionInfo.byVideoEncType >= 7 && struCompressionInfo.byVideoEncType <= 10)
|
||||
{
|
||||
struCompressionInfoLocal.iVideoEncType = struCompressionInfo.byVideoEncType-4;
|
||||
}
|
||||
else
|
||||
{
|
||||
struCompressionInfoLocal.iVideoEncType = 7;
|
||||
}
|
||||
|
||||
// 9.VideoEncComplexity
|
||||
if (0xfe == struCompressionInfo.byVideoEncComplexity)
|
||||
{
|
||||
struCompressionInfoLocal.iVideoEncComplexity = 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
struCompressionInfoLocal.iVideoEncComplexity = struCompressionInfo.byVideoEncComplexity;
|
||||
}
|
||||
|
||||
// 10.EnableSvc
|
||||
struCompressionInfoLocal.iEnableSvc = struCompressionInfo.byEnableSvc;
|
||||
|
||||
// 11.FormatType
|
||||
if (0 == struCompressionInfo.byFormatType)
|
||||
{
|
||||
struCompressionInfoLocal.iFormatType = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
struCompressionInfoLocal.iFormatType = struCompressionInfo.byFormatType-1;
|
||||
}
|
||||
|
||||
// 12.SteamSmooth
|
||||
struCompressionInfoLocal.iSteamSmooth = struCompressionInfo.bySteamSmooth;
|
||||
}
|
||||
|
||||
private void SetLocalCur(COMPRESSION_INFO_LOCAL struCompressionInfoLocal)
|
||||
{
|
||||
// 1.StreamType
|
||||
m_cmbVideoType.setSelectedItem(m_sVideoType[struCompressionInfoLocal.iStreamType]);
|
||||
|
||||
// 2.Resolution
|
||||
m_cmbResolution.setSelectedItem(m_sResolution[struCompressionInfoLocal.iResolution]);
|
||||
|
||||
// 3.BitrateType
|
||||
m_cmbRateType.setSelectedItem(m_sRateType[struCompressionInfoLocal.iBitrateType]);
|
||||
|
||||
// 4.PicQuality
|
||||
m_cmbImageQuality.setSelectedItem(m_sImageQuality[struCompressionInfoLocal.iPicQuality]);
|
||||
|
||||
// 5.VideoBitrate
|
||||
m_cmbVideoBitrate.setSelectedItem(m_sVideoBitrate[struCompressionInfoLocal.iVideoBitrate]);
|
||||
|
||||
// 6.VideoFrameRate
|
||||
m_cmbVideoFrameRate.setSelectedItem(m_sVidemoFrameRate[struCompressionInfoLocal.iVideoFrameRate]);
|
||||
|
||||
// 7.IntervalBPFrame
|
||||
m_cmbIntervalBPFrame.setSelectedItem(m_sIntervalBPFrame[struCompressionInfoLocal.iIntervalBPFrame]);
|
||||
|
||||
// 8.VideoEncType
|
||||
m_cmbVideoEncType.setSelectedItem(m_sVideoEncType[struCompressionInfoLocal.iVideoEncType]);
|
||||
|
||||
// 9.VideoEncComplexity
|
||||
m_cmbVideoEncComplexity.setSelectedItem(m_sVideoEncComplexity[struCompressionInfoLocal.iVideoEncComplexity]);
|
||||
|
||||
// 10.EnableSvc
|
||||
m_cmbEnableSvc.setSelectedItem(m_sEnableSvc[struCompressionInfoLocal.iEnableSvc]);
|
||||
|
||||
// 11.FormatType
|
||||
m_cmbFormatType.setSelectedItem(m_sFormatType[struCompressionInfoLocal.iFormatType]);
|
||||
|
||||
// 12.SteamSmooth
|
||||
m_slider.setValue(struCompressionInfoLocal.iSteamSmooth);
|
||||
m_textFieldStreamSmoothing.setText(""+m_slider.getValue());
|
||||
}
|
||||
|
||||
private void StreamTypeChanged(String sStreamType)
|
||||
{
|
||||
switch (sStreamType)
|
||||
{
|
||||
case "Main Stream (Timing)":
|
||||
FindLocalCur(m_struMultiStreamCompressionCfg.struMultiStreamCompressionCfg1.struStreamPara, m_struCompressionInfoLocal);
|
||||
SetLocalCur(m_struCompressionInfoLocal);
|
||||
break;
|
||||
case "Sub Stream (Net)":
|
||||
FindLocalCur(m_struMultiStreamCompressionCfg.struMultiStreamCompressionCfg2.struStreamPara, m_struCompressionInfoLocal);
|
||||
SetLocalCur(m_struCompressionInfoLocal);
|
||||
break;
|
||||
case "Event Stream":
|
||||
FindLocalCur(m_struMultiStreamCompressionCfg.struMultiStreamCompressionCfg3.struStreamPara, m_struCompressionInfoLocal);
|
||||
SetLocalCur(m_struCompressionInfoLocal);
|
||||
break;
|
||||
case "Third Stream":
|
||||
FindLocalCur(m_struMultiStreamCompressionCfg.struMultiStreamCompressionCfg4.struStreamPara, m_struCompressionInfoLocal);
|
||||
SetLocalCur(m_struCompressionInfoLocal);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetCompressionInfo(HCNetSDK.NET_DVR_COMPRESSION_INFO_V30 struCompressionInfo)
|
||||
{
|
||||
// 1.StreamType
|
||||
if (2 == m_cmbVideoType.getSelectedIndex())
|
||||
{
|
||||
struCompressionInfo.byStreamType = (byte)0xfe;
|
||||
}
|
||||
else
|
||||
{
|
||||
struCompressionInfo.byStreamType = (byte)m_cmbVideoType.getSelectedIndex();
|
||||
}
|
||||
|
||||
// 2.Resolution
|
||||
if (m_cmbResolution.getSelectedIndex() >= 0 && m_cmbResolution.getSelectedIndex() <=4)
|
||||
{
|
||||
struCompressionInfo.byResolution = (byte)m_cmbResolution.getSelectedIndex();
|
||||
}
|
||||
else if (m_cmbResolution.getSelectedIndex() >= 5 && m_cmbResolution.getSelectedIndex() <=6)
|
||||
{
|
||||
struCompressionInfo.byResolution = (byte)(m_cmbResolution.getSelectedIndex()+1);
|
||||
}
|
||||
else if (m_cmbResolution.getSelectedIndex() >= 7 && m_cmbResolution.getSelectedIndex() <=8)
|
||||
{
|
||||
struCompressionInfo.byResolution = (byte)(m_cmbResolution.getSelectedIndex()+5);
|
||||
}
|
||||
else if (m_cmbResolution.getSelectedIndex() >= 9 && m_cmbResolution.getSelectedIndex() <=17)
|
||||
{
|
||||
struCompressionInfo.byResolution = (byte)(m_cmbResolution.getSelectedIndex()+7);
|
||||
}
|
||||
else if (m_cmbResolution.getSelectedIndex() >= 18 && m_cmbResolution.getSelectedIndex() <=77)
|
||||
{
|
||||
struCompressionInfo.byResolution = (byte)(m_cmbResolution.getSelectedIndex()+9);
|
||||
}
|
||||
else
|
||||
{
|
||||
struCompressionInfo.byResolution = (byte)0xff;
|
||||
}
|
||||
|
||||
// 3.BitrateType
|
||||
struCompressionInfo.byBitrateType = (byte)m_cmbRateType.getSelectedIndex();
|
||||
|
||||
// 4.PicQuality
|
||||
if (m_cmbImageQuality.getSelectedIndex() >= 0 && m_cmbImageQuality.getSelectedIndex() <= 5)
|
||||
{
|
||||
struCompressionInfo.byPicQuality = (byte)m_cmbImageQuality.getSelectedIndex();
|
||||
}
|
||||
else
|
||||
{
|
||||
struCompressionInfo.byPicQuality = (byte)0xfe;
|
||||
}
|
||||
|
||||
// 5.VideoBitrate
|
||||
if (m_cmbVideoBitrate.getSelectedIndex() >= 0 && m_cmbVideoBitrate.getSelectedIndex() <= 25)
|
||||
{
|
||||
struCompressionInfo.dwVideoBitrate = m_cmbVideoBitrate.getSelectedIndex()+2;
|
||||
}
|
||||
else
|
||||
{
|
||||
struCompressionInfo.dwVideoBitrate = 0xfffffffe;
|
||||
}
|
||||
|
||||
// 6.VideoFrameRate
|
||||
if (33 == m_cmbVideoFrameRate.getSelectedIndex())
|
||||
{
|
||||
struCompressionInfo.dwVideoFrameRate = 0xfffffffe;
|
||||
}
|
||||
else
|
||||
{
|
||||
struCompressionInfo.dwVideoFrameRate = m_cmbVideoFrameRate.getSelectedIndex();
|
||||
}
|
||||
|
||||
// 7.IntervalBPFrame
|
||||
struCompressionInfo.byIntervalBPFrame = (byte)m_cmbIntervalBPFrame.getSelectedIndex();
|
||||
|
||||
// 8.VideoEncType
|
||||
if (m_cmbVideoEncType.getSelectedIndex() >= 0 && m_cmbVideoEncType.getSelectedIndex() <= 2)
|
||||
{
|
||||
struCompressionInfo.byVideoEncType = (byte)m_cmbVideoEncType.getSelectedIndex();
|
||||
}
|
||||
else if (m_cmbVideoEncType.getSelectedIndex() >= 3 && m_cmbVideoEncType.getSelectedIndex() <= 6)
|
||||
{
|
||||
struCompressionInfo.byVideoEncType = (byte)(m_cmbVideoEncType.getSelectedIndex()+4);
|
||||
}
|
||||
else
|
||||
{
|
||||
struCompressionInfo.byVideoEncType = (byte)0xfe;
|
||||
}
|
||||
|
||||
// 9.VideoEncComplexity
|
||||
if (3 == m_cmbVideoEncComplexity.getSelectedIndex())
|
||||
{
|
||||
struCompressionInfo.byVideoEncComplexity = (byte)0xfe;
|
||||
}
|
||||
else
|
||||
{
|
||||
struCompressionInfo.byVideoEncComplexity = (byte)m_cmbVideoEncComplexity.getSelectedIndex();
|
||||
}
|
||||
|
||||
// 10.EnableSvc
|
||||
struCompressionInfo.byEnableSvc = (byte)m_cmbEnableSvc.getSelectedIndex();
|
||||
|
||||
// 11.FormatType
|
||||
struCompressionInfo.byFormatType = (byte)(m_cmbFormatType.getSelectedIndex()+1);
|
||||
|
||||
// 12.SteamSmooth
|
||||
struCompressionInfo.bySteamSmooth = (byte)m_slider.getValue();
|
||||
}
|
||||
|
||||
private void SetStreamType(String sStreamType)
|
||||
{
|
||||
//String sStreamType = (String)m_cmbStreamType.getSelectedItem();
|
||||
switch (sStreamType)
|
||||
{
|
||||
case "Main Stream (Timing)":
|
||||
SetCompressionInfo(m_struMultiStreamCompressionCfg.struMultiStreamCompressionCfg1.struStreamPara);
|
||||
break;
|
||||
case "Sub Stream (Net)":
|
||||
SetCompressionInfo(m_struMultiStreamCompressionCfg.struMultiStreamCompressionCfg2.struStreamPara);
|
||||
break;
|
||||
case "Event Stream":
|
||||
SetCompressionInfo(m_struMultiStreamCompressionCfg.struMultiStreamCompressionCfg3.struStreamPara);
|
||||
break;
|
||||
case "Third Stream":
|
||||
SetCompressionInfo(m_struMultiStreamCompressionCfg.struMultiStreamCompressionCfg4.struStreamPara);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
TEMPLATE = app
|
||||
|
||||
|
||||
UI_DIR = obj/Gui
|
||||
MOC_DIR = obj/Moc
|
||||
OBJECTS_DIR = obj/Obj
|
||||
|
||||
TARGET = ../lib/QtClientDemo
|
||||
QT += core \
|
||||
gui \
|
||||
opengl
|
||||
|
||||
|
||||
TRANSLATIONS = ../../translation/QtDemo_zh_CN.ts
|
||||
|
||||
RESOURCES = ../../src/Player.qrc
|
||||
|
||||
|
||||
win32 {
|
||||
}
|
||||
|
||||
unix {
|
||||
LIBS += -L../lib/ -Wl,-rpath=./:./HCNetSDKCom:../lib -lhcnetsdk -lPlayCtrl -lAudioRender -lSuperRender
|
||||
}
|
||||
|
||||
HEADERS += ../../src/MainWindow/DeviceTree/DeviceAttr/deviceattr.h \
|
||||
../../src/MainWindow/DeviceTree/ChannelAttr/channelattr.h \
|
||||
../../src/MainWindow/DeviceTree/AddNode/addnode.h \
|
||||
../../src/MainWindow/DeviceTree/treemodel.h \
|
||||
../../src/MainWindow/DeviceTree/treeitem.h \
|
||||
../../src/MainWindow/DeviceTree/devicedata.h \
|
||||
../../src/MainWindow/DeviceTree/channeldata.h \
|
||||
../../src/MainWindow/LogAlarm/AlarmTable/alarmtable.h \
|
||||
../../src/MainWindow/LogAlarm/LogTable/logtable.h \
|
||||
../../src/RealPlay/realplay.h \
|
||||
../../src/RealPlay/PTZ/PtzCruise/ptzcruise.h \
|
||||
../../src/RealPlay/PTZ/PtzPreset/ptzpreset.h \
|
||||
../../src/PlayBack/playback.h \
|
||||
../../src/ManageDevice/Timing/timing.h \
|
||||
../../src/ManageDevice/Update/remoteupdate.h \
|
||||
../../src/ManageDevice/Format/formatdisk.h \
|
||||
../../src/ManageDevice/Reboot/rebootdevice.h \
|
||||
../../src/ManageDevice/Shutdown/shutdowndevice.h \
|
||||
../../src/ManageDevice/LogSearch/logsearch.h \
|
||||
../../src/ManageDevice/DeviceState/devicestate.h \
|
||||
../../src/ManageDevice/Reset/resetdevice.h \
|
||||
../../src/OtherFunc/Deployment/deploy.h \
|
||||
../../src/OtherFunc/DevicePan/devicepan.h \
|
||||
../../src/OtherFunc/ImportConfig/importconfig.h \
|
||||
../../src/OtherFunc/SerialTransfer/serialtransfer.h \
|
||||
../../src/OtherFunc/AudioBroadcast/audiobroadcast.h \
|
||||
../../src/OtherFunc/AudioIntercom/audiointercom.h \
|
||||
../../src/OtherFunc/AudioTransfer/audiotransfer.h \
|
||||
../../src/ExitModule/exitdemo.h \
|
||||
../../src/qtclientdemo.h \
|
||||
../../src/ParaConfig/configure_params/PublicFuc/publicfuc.h \
|
||||
../../src/ParaConfig/configure_params/cconfigureparams.h \
|
||||
../../src/RealPlay/FramePlayWnd.h \
|
||||
../../src/Public/DemoPublic.h
|
||||
|
||||
SOURCES += ../../src/MainWindow/DeviceTree/DeviceAttr/deviceattr.cpp \
|
||||
../../src/MainWindow/DeviceTree/ChannelAttr/channelattr.cpp \
|
||||
../../src/MainWindow/DeviceTree/AddNode/addnode.cpp \
|
||||
../../src/MainWindow/DeviceTree/treemodel.cpp \
|
||||
../../src/MainWindow/DeviceTree/treeitem.cpp \
|
||||
../../src/MainWindow/DeviceTree/devicedata.cpp \
|
||||
../../src/MainWindow/DeviceTree/channeldata.cpp \
|
||||
../../src/MainWindow/LogAlarm/AlarmTable/alarmtable.cpp \
|
||||
../../src/MainWindow/LogAlarm/LogTable/logtable.cpp \
|
||||
../../src/RealPlay/realplay.cpp \
|
||||
../../src/RealPlay/PTZ/PtzCruise/ptzcruise.cpp \
|
||||
../../src/RealPlay/PTZ/PtzPreset/ptzpreset.cpp \
|
||||
../../src/PlayBack/playback.cpp \
|
||||
../../src/ManageDevice/Timing/timing.cpp \
|
||||
../../src/ManageDevice/Update/remoteupdate.cpp \
|
||||
../../src/ManageDevice/Format/formatdisk.cpp \
|
||||
../../src/ManageDevice/Reboot/rebootdevice.cpp \
|
||||
../../src/ManageDevice/Shutdown/shutdowndevice.cpp \
|
||||
../../src/ManageDevice/LogSearch/logsearch.cpp \
|
||||
../../src/ManageDevice/DeviceState/devicestate.cpp \
|
||||
../../src/ManageDevice/Reset/resetdevice.cpp \
|
||||
../../src/OtherFunc/Deployment/deploy.cpp \
|
||||
../../src/OtherFunc/DevicePan/devicepan.cpp \
|
||||
../../src/OtherFunc/ImportConfig/importconfig.cpp \
|
||||
../../src/OtherFunc/SerialTransfer/serialtransfer.cpp \
|
||||
../../src/OtherFunc/AudioBroadcast/audiobroadcast.cpp \
|
||||
../../src/OtherFunc/AudioIntercom/audiointercom.cpp \
|
||||
../../src/OtherFunc/AudioTransfer/audiotransfer.cpp \
|
||||
../../src/ExitModule/exitdemo.cpp \
|
||||
../../src/main.cpp \
|
||||
../../src/qtclientdemo.cpp \
|
||||
../../src/ParaConfig/configure_params/PublicFuc/publicfuc.cpp \
|
||||
../../src/ParaConfig/configure_params/cconfigureparams.cpp \
|
||||
../../src/RealPlay/FramePlayWnd.cpp
|
||||
|
||||
FORMS += ../../src/MainWindow/DeviceTree/DeviceAttr/deviceattr.ui \
|
||||
../../src/MainWindow/DeviceTree/ChannelAttr/channelattr.ui \
|
||||
../../src/MainWindow/DeviceTree/AddNode/addnode.ui \
|
||||
../../src/MainWindow/LogAlarm/AlarmTable/alarmtable.ui \
|
||||
../../src/MainWindow/LogAlarm/LogTable/logtable.ui \
|
||||
../../src/RealPlay/realplay.ui \
|
||||
../../src/RealPlay/PTZ/PtzCruise/ptzcruise.ui \
|
||||
../../src/RealPlay/PTZ/PtzPreset/ptzpreset.ui \
|
||||
../../src/PlayBack/playback.ui \
|
||||
../../src/ManageDevice/Timing/timing.ui \
|
||||
../../src/ManageDevice/Update/remoteupdate.ui \
|
||||
../../src/ManageDevice/Format/formatdisk.ui \
|
||||
../../src/ManageDevice/Reboot/rebootdevice.ui \
|
||||
../../src/ManageDevice/Shutdown/shutdowndevice.ui \
|
||||
../../src/ManageDevice/LogSearch/logsearch.ui \
|
||||
../../src/ManageDevice/DeviceState/devicestate.ui \
|
||||
../../src/ManageDevice/Reset/resetdevice.ui \
|
||||
../../src/OtherFunc/Deployment/deploy.ui \
|
||||
../../src/OtherFunc/DevicePan/devicepan.ui \
|
||||
../../src/OtherFunc/ImportConfig/importconfig.ui \
|
||||
../../src/OtherFunc/SerialTransfer/serialtransfer.ui \
|
||||
../../src/OtherFunc/AudioBroadcast/audiobroadcast.ui \
|
||||
../../src/OtherFunc/AudioIntercom/audiointercom.ui \
|
||||
../../src/OtherFunc/AudioTransfer/audiotransfer.ui \
|
||||
../../src/ExitModule/exitdemo.ui \
|
||||
../../src/qtclientdemo.ui \
|
||||
../../src/ParaConfig/configure_params/cconfigureparams.ui \
|
||||
../../src/RealPlay/FramePlayWnd.ui
|
||||
|
||||
INCLUDEPATH += ../../src/MainWindow/DeviceTree/ \
|
||||
../../src/MainWindow/DeviceTree/AddNode/ \
|
||||
../../src/MainWindow/DeviceTree/DeviceAttr/ \
|
||||
../../src/MainWindow/LogAlarm/AlarmTable/ \
|
||||
../../src/MainWindow/LogAlarm/LogTable/ \
|
||||
../../src/MainWindow/DeviceTree/ChannelAttr/ \
|
||||
../../src/RealPlay/ \
|
||||
../../src/RealPlay/PTZ/PtzCruise/ \
|
||||
../../src/RealPlay/PTZ/PtzPreset/ \
|
||||
../../src/PlayBack/ \
|
||||
../../src/ManageDevice/Timing/ \
|
||||
../../src/ManageDevice/Update/ \
|
||||
../../src/ManageDevice/Format/ \
|
||||
../../src/ManageDevice/Reboot/ \
|
||||
../../src/ManageDevice/Shutdown/ \
|
||||
../../src/ManageDevice/LogSearch/ \
|
||||
../../src/ManageDevice/DeviceState/ \
|
||||
../../src/ManageDevice/Reset/ \
|
||||
../../src/OtherFunc/Deployment/ \
|
||||
../../src/OtherFunc/DevicePan/ \
|
||||
../../src/OtherFunc/ImportConfig/ \
|
||||
../../src/OtherFunc/SerialTransfer/ \
|
||||
../../src/OtherFunc/AudioBroadcast/ \
|
||||
../../src/OtherFunc/AudioIntercom/ \
|
||||
../../src/OtherFunc/AudioTransfer/ \
|
||||
../../src/ExitModule/ \
|
||||
../../src/ParaConfig/configure_params/ \
|
||||
../../src/ParaConfig/configure_params/RemoteParams \
|
||||
../../src/ParaConfig/configure_params/RemoteParams/NetParams \
|
||||
../../src/ParaConfig/configure_params/RemoteParams/ChannelParams \
|
||||
../../src/ParaConfig/configure_params/RemoteParams/UserParams \
|
||||
../../src/ParaConfig/configure_params/RemoteParams/ExceptionParams \
|
||||
../../src/ParaConfig/configure_params/RemoteParams/SerialParams \
|
||||
../../src/ParaConfig/configure_params/RemoteParams/AlarmParams \
|
||||
../../src/ParaConfig/configure_params/RemoteParams/ATMParams\
|
||||
../../src/ParaConfig/configure_params/PublicFuc\
|
||||
../../src/ParaConfig/configure_params/IPParams\
|
||||
../../src/ParaConfig/configure_params/HardDiskParams \
|
||||
../../src/ \
|
||||
../../includeCn \
|
||||
../../src/Public
|
||||
|
||||
include(../../src/ParaConfig/configure_params/RemoteParams/RemoteParams.pri)
|
||||
include(../../src/ParaConfig/configure_params/RemoteParams/NetParams/NetParams.pri)
|
||||
include(../../src/ParaConfig/configure_params/RemoteParams/ChannelParams/ChannelParams.pri)
|
||||
include(../../src/ParaConfig/configure_params/RemoteParams/UserParams/UserParams.pri)
|
||||
include(../../src/ParaConfig/configure_params/RemoteParams/ExceptionParams/ExceptionParams.pri)
|
||||
include(../../src/ParaConfig/configure_params/RemoteParams/SerialParams/SerialParams.pri)
|
||||
include(../../src/ParaConfig/configure_params/RemoteParams/AlarmParams/AlarmParams.pri)
|
||||
include(../../src/ParaConfig/configure_params/RemoteParams/ATMParams/ATMParams.pri)
|
||||
include(../../src/ParaConfig/configure_params/IPParams/IPParams.pri)
|
||||
include(../../src/ParaConfig/configure_params/HardDiskParams/HardDiskParams.pri)
|
||||
|
||||
@@ -0,0 +1,628 @@
|
||||
<device>
|
||||
172.7.76.91
|
||||
172.7.76.91
|
||||
8001
|
||||
admin
|
||||
12345
|
||||
<channel>
|
||||
Cameral1
|
||||
1
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
</device>
|
||||
<device>
|
||||
172.7.96.99
|
||||
172.7.96.99
|
||||
8000
|
||||
admin
|
||||
12345
|
||||
<channel>
|
||||
Cameral1
|
||||
1
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral2
|
||||
2
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral3
|
||||
3
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral4
|
||||
4
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral5
|
||||
5
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral6
|
||||
6
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral7
|
||||
7
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral8
|
||||
8
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral9
|
||||
9
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral10
|
||||
10
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral11
|
||||
11
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral12
|
||||
12
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral13
|
||||
13
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral14
|
||||
14
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral15
|
||||
15
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral16
|
||||
16
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
IPCameral1
|
||||
1
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
</device>
|
||||
<device>
|
||||
172.4.1.170
|
||||
172.4.1.170
|
||||
8000
|
||||
admin
|
||||
12345
|
||||
<channel>
|
||||
Cameral1
|
||||
1
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral2
|
||||
2
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral3
|
||||
3
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral4
|
||||
4
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral5
|
||||
5
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral6
|
||||
6
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral7
|
||||
7
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral8
|
||||
8
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral9
|
||||
9
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral10
|
||||
10
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral11
|
||||
11
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral12
|
||||
12
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral13
|
||||
13
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral14
|
||||
14
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral15
|
||||
15
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral16
|
||||
16
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
IPCameral1
|
||||
33
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
IPCameral2
|
||||
34
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
</device>
|
||||
<device>
|
||||
171
|
||||
172.4.1.171
|
||||
8000
|
||||
admin
|
||||
12345
|
||||
<channel>
|
||||
Cameral1
|
||||
1
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral2
|
||||
2
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral3
|
||||
3
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral4
|
||||
4
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral5
|
||||
5
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral6
|
||||
6
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral7
|
||||
7
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral8
|
||||
8
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral9
|
||||
9
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral10
|
||||
10
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral11
|
||||
11
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral12
|
||||
12
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral13
|
||||
13
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral14
|
||||
14
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral15
|
||||
15
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral16
|
||||
16
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
IPCameral1
|
||||
33
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
IPCameral2
|
||||
34
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
IPCameral3
|
||||
35
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
</device>
|
||||
<device>
|
||||
172.4.1.170
|
||||
172.4.1.170
|
||||
8000
|
||||
admin
|
||||
12345
|
||||
<channel>
|
||||
Cameral1
|
||||
1
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral2
|
||||
2
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral3
|
||||
3
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral4
|
||||
4
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral5
|
||||
5
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral6
|
||||
6
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral7
|
||||
7
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral8
|
||||
8
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral9
|
||||
9
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral10
|
||||
10
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral11
|
||||
11
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral12
|
||||
12
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral13
|
||||
13
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral14
|
||||
14
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral15
|
||||
15
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral16
|
||||
16
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
IPCameral1
|
||||
33
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
IPCameral2
|
||||
34
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
</device>
|
||||
<device>
|
||||
172.4.1.225
|
||||
172.4.1.225
|
||||
8000
|
||||
admin
|
||||
12345
|
||||
<channel>
|
||||
Cameral1
|
||||
1
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
</device>
|
||||
<device>
|
||||
172.4.129.222
|
||||
172.4.129.222
|
||||
8000
|
||||
admin
|
||||
12345
|
||||
<channel>
|
||||
Cameral1
|
||||
1
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
</device>
|
||||
<device>
|
||||
172.4.1.221
|
||||
172.4.1.221
|
||||
8000
|
||||
admin
|
||||
12345
|
||||
<channel>
|
||||
Cameral1
|
||||
1
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
</device>
|
||||
<device>
|
||||
172.4.1.223
|
||||
172.4.1.223
|
||||
8000
|
||||
admin
|
||||
12345
|
||||
<channel>
|
||||
Cameral1
|
||||
1
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
</device>
|
||||
<device>
|
||||
172.9.6.97
|
||||
172.9.6.97
|
||||
8000
|
||||
admin
|
||||
12345
|
||||
<channel>
|
||||
Cameral1
|
||||
1
|
||||
error
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral2
|
||||
2
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral3
|
||||
3
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral4
|
||||
4
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral5
|
||||
5
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral6
|
||||
6
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral7
|
||||
7
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral8
|
||||
8
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral9
|
||||
9
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral10
|
||||
10
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral11
|
||||
11
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral12
|
||||
12
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral13
|
||||
13
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral14
|
||||
14
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral15
|
||||
15
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
<channel>
|
||||
Cameral16
|
||||
16
|
||||
TCP
|
||||
MAINSTREAM
|
||||
</channel>
|
||||
</device>
|
||||
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 47 KiB |
|
After Width: | Height: | Size: 246 B |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 822 B |
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 49 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 822 B |
@@ -0,0 +1,853 @@
|
||||
#ifndef __LINUX_PLAYM4_H__
|
||||
#define __LINUX_PLAYM4_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
typedef unsigned int PLAYM4_HWND;
|
||||
typedef void * PLAYM4_HDC;
|
||||
|
||||
#define PLAYM4_API
|
||||
|
||||
#define __stdcall
|
||||
|
||||
#ifndef CALLBACK
|
||||
#define CALLBACK
|
||||
#endif
|
||||
|
||||
//Max channel numbers
|
||||
#define PLAYM4_MAX_SUPPORTS 500
|
||||
|
||||
//Wave coef range;
|
||||
#define MIN_WAVE_COEF -100
|
||||
#define MAX_WAVE_COEF 100
|
||||
|
||||
//Timer type
|
||||
#define TIMER_1 1 //Only 16 timers for every process.Default TIMER;
|
||||
#define TIMER_2 2 //Not limit;But the precision less than TIMER_1;
|
||||
|
||||
//BUFFER AND DATA TYPE
|
||||
#define BUF_VIDEO_SRC (1) //mixed input,total src buffer size;splited input,video src buffer size
|
||||
#define BUF_AUDIO_SRC (2) //mixed input,not defined;splited input,audio src buffer size
|
||||
#define BUF_VIDEO_RENDER (3) //video render node count or node cout for decoded data
|
||||
#define BUF_AUDIO_RENDER (4) //audio render node count
|
||||
#define BUF_VIDEO_DECODED (5) //video decoded node count to render
|
||||
#define BUF_AUDIO_DECODED (6) //audio decoded node count to render
|
||||
|
||||
//Error code
|
||||
#define PLAYM4_NOERROR 0 //no error
|
||||
#define PLAYM4_PARA_OVER 1 //input parameter is invalid;
|
||||
#define PLAYM4_ORDER_ERROR 2 //The order of the function to be called is error.
|
||||
#define PLAYM4_TIMER_ERROR 3 //Create multimedia clock failed;
|
||||
#define PLAYM4_DEC_VIDEO_ERROR 4 //Decode video data failed.
|
||||
#define PLAYM4_DEC_AUDIO_ERROR 5 //Decode audio data failed.
|
||||
#define PLAYM4_ALLOC_MEMORY_ERROR 6 //Allocate memory failed.
|
||||
#define PLAYM4_OPEN_FILE_ERROR 7 //Open the file failed.
|
||||
#define PLAYM4_CREATE_OBJ_ERROR 8 //Create thread or event failed
|
||||
//#define PLAYM4_CREATE_DDRAW_ERROR 9 //Create DirectDraw object failed.
|
||||
//#define PLAYM4_CREATE_OFFSCREEN_ERROR 10 //failed when creating off-screen surface.
|
||||
#define PLAYM4_BUF_OVER 11 //buffer is overflow
|
||||
#define PLAYM4_CREATE_SOUND_ERROR 12 //failed when creating audio device.
|
||||
#define PLAYM4_SET_VOLUME_ERROR 13 //Set volume failed
|
||||
#define PLAYM4_SUPPORT_FILE_ONLY 14 //The function only support play file.
|
||||
#define PLAYM4_SUPPORT_STREAM_ONLY 15 //The function only support play stream.
|
||||
#define PLAYM4_SYS_NOT_SUPPORT 16 //System not support.
|
||||
#define PLAYM4_FILEHEADER_UNKNOWN 17 //No file header.
|
||||
#define PLAYM4_VERSION_INCORRECT 18 //The version of decoder and encoder is not adapted.
|
||||
#define PLAYM4_INIT_DECODER_ERROR 19 //Initialize decoder failed.
|
||||
#define PLAYM4_CHECK_FILE_ERROR 20 //The file data is unknown.
|
||||
#define PLAYM4_INIT_TIMER_ERROR 21 //Initialize multimedia clock failed.
|
||||
#define PLAYM4_BLT_ERROR 22 //Display failed.
|
||||
//#define PLAYM4_UPDATE_ERROR 23 //Update failed.
|
||||
#define PLAYM4_OPEN_FILE_ERROR_MULTI 24 //openfile error, streamtype is multi
|
||||
#define PLAYM4_OPEN_FILE_ERROR_VIDEO 25 //openfile error, streamtype is video
|
||||
#define PLAYM4_JPEG_COMPRESS_ERROR 26 //JPEG compress error
|
||||
#define PLAYM4_EXTRACT_NOT_SUPPORT 27 //Don't support the version of this file.
|
||||
#define PLAYM4_EXTRACT_DATA_ERROR 28 //extract video data failed.
|
||||
#define PLAYM4_SECRET_KEY_ERROR 29 //Secret key is error //add 20071218
|
||||
#define PLAYM4_DECODE_KEYFRAME_ERROR 30 //add by hy 20090318
|
||||
#define PLAYM4_NEED_MORE_DATA 31 //add by hy 20100617
|
||||
#define PLAYM4_INVALID_PORT 32 //add by cj 20100913
|
||||
#define PLAYM4_NOT_FIND 33 //add by cj 20110428
|
||||
#define PLAYM4_NEED_LARGER_BUFFER 34 //add by pzj 20130528
|
||||
#define PLAYM4_FAIL_UNKNOWN 99 //Fail, but the reason is unknown;
|
||||
|
||||
//<2F><><EFBFBD>۹<EFBFBD><DBB9>ܴ<EFBFBD><DCB4><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define PLAYM4_FEC_ERR_ENABLEFAIL 100 // <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
|
||||
#define PLAYM4_FEC_ERR_NOTENABLE 101 // <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>û<EFBFBD>м<EFBFBD><D0BC><EFBFBD>
|
||||
#define PLAYM4_FEC_ERR_NOSUBPORT 102 // <20>Ӷ˿<D3B6>û<EFBFBD>з<EFBFBD><D0B7><EFBFBD>
|
||||
#define PLAYM4_FEC_ERR_PARAMNOTINIT 103 // û<>г<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>Ӧ<EFBFBD>˿ڵIJ<DAB5><C4B2><EFBFBD>
|
||||
#define PLAYM4_FEC_ERR_SUBPORTOVER 104 // <20>Ӷ˿<D3B6><CBBF>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define PLAYM4_FEC_ERR_EFFECTNOTSUPPORT 105 // <20>ð<EFBFBD>װ<EFBFBD><D7B0>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>֧<EFBFBD><D6A7>
|
||||
#define PLAYM4_FEC_ERR_INVALIDWND 106 // <20>Ƿ<EFBFBD><C7B7>Ĵ<EFBFBD><C4B4><EFBFBD>
|
||||
#define PLAYM4_FEC_ERR_PTZOVERFLOW 107 // PTZλ<5A><CEBB>Խ<EFBFBD><D4BD>
|
||||
#define PLAYM4_FEC_ERR_RADIUSINVALID 108 // Բ<>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD>Ƿ<EFBFBD>
|
||||
#define PLAYM4_FEC_ERR_UPDATENOTSUPPORT 109 // ָ<><D6B8><EFBFBD>İ<EFBFBD>װ<EFBFBD><D7B0>ʽ<EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD><EFBFBD>ò<EFBFBD><C3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>²<EFBFBD>֧<EFBFBD><D6A7>
|
||||
#define PLAYM4_FEC_ERR_NOPLAYPORT 110 // <20><><EFBFBD>ſ<EFBFBD><C5BF>˿<EFBFBD>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define PLAYM4_FEC_ERR_PARAMVALID 111 // <20><><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>
|
||||
#define PLAYM4_FEC_ERR_INVALIDPORT 112 // <20>Ƿ<EFBFBD><C7B7>Ӷ˿<D3B6>
|
||||
#define PLAYM4_FEC_ERR_PTZZOOMOVER 113 // PTZ<54><5A><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ΧԽ<CEA7><D4BD>
|
||||
#define PLAYM4_FEC_ERR_OVERMAXPORT 114 // <20><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD>ֵĽ<D6B5><C4BD><EFBFBD>ͨ<EFBFBD><CDA8>Ϊ<EFBFBD>ĸ<EFBFBD>
|
||||
#define PLAYM4_FEC_ERR_ENABLED 115 // <20>ö˿<C3B6><CBBF>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
||||
#define PLAYM4_FEC_ERR_D3DACCENOTENABLE 116 // D3D<33><44><EFBFBD><EFBFBD>û<EFBFBD>п<EFBFBD><D0BF><EFBFBD>-windows<77><73><EFBFBD>۴<EFBFBD><DBB4><EFBFBD><EFBFBD><EFBFBD>-Linux<75><78>
|
||||
#define PLAYM4_FEC_ERR_PLACETYPE 117 // <20><>װ<EFBFBD><D7B0>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>.һ<><D2BB><EFBFBD><EFBFBD><EFBFBD>ſ<EFBFBD>port<72><74><EFBFBD><EFBFBD>Ӧһ<D3A6>ְ<EFBFBD>װ<EFBFBD><D7B0>ʽ
|
||||
#define PLAYM4_FEC_ERR_NULLWND 118 // <20><><EFBFBD>õ<EFBFBD><C3B5><EFBFBD><EFBFBD>۴<EFBFBD><DBB4><EFBFBD>hWndΪnull<6C><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>port<72>Ĵ<EFBFBD><C4B4>ڸ<EFBFBD><DAB8><EFBFBD>
|
||||
#define PLAYM4_FEC_ERR_CorrectType 119 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD><EFBFBD><EFBFBD>,<2C><><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD><EFBFBD><EFBFBD>,һ<><D2BB><EFBFBD><EFBFBD><EFBFBD>ſ<EFBFBD>port,<2C><><EFBFBD><EFBFBD>PTZ,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽֻ<CABD>ܿ<EFBFBD>һ·;<3B><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>180<38>Ƚ<EFBFBD><C8BD><EFBFBD>ʱֻ<CAB1><D6BB>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ·<D2BB><C2B7>
|
||||
|
||||
//Max display regions.
|
||||
#define MAX_DISPLAY_WND 4
|
||||
|
||||
//Display type
|
||||
#define DISPLAY_NORMAL 0x00000001
|
||||
#define DISPLAY_QUARTER 0x00000002
|
||||
#define DISPLAY_YC_SCALE 0x00000004 //add by gb 20091116
|
||||
#define DISPLAY_NOTEARING 0x00000008
|
||||
//Display buffers
|
||||
#define MAX_DIS_FRAMES 50
|
||||
#define MIN_DIS_FRAMES 1
|
||||
|
||||
//Locate by
|
||||
#define BY_FRAMENUM 1
|
||||
#define BY_FRAMETIME 2
|
||||
|
||||
//Source buffer
|
||||
#define SOURCE_BUF_MAX 1024*100000
|
||||
#define SOURCE_BUF_MIN 1024*50
|
||||
|
||||
//Stream type
|
||||
#define STREAME_REALTIME 0
|
||||
#define STREAME_FILE 1
|
||||
|
||||
//frame type
|
||||
#define T_AUDIO16 101
|
||||
#define T_AUDIO8 100
|
||||
#define T_UYVY 1
|
||||
#define T_YV12 3
|
||||
#define T_RGB32 7
|
||||
|
||||
//capability
|
||||
#define SUPPORT_DDRAW 1
|
||||
#define SUPPORT_BLT 2
|
||||
#define SUPPORT_BLTFOURCC 4
|
||||
#define SUPPORT_BLTSHRINKX 8
|
||||
#define SUPPORT_BLTSHRINKY 16
|
||||
#define SUPPORT_BLTSTRETCHX 32
|
||||
#define SUPPORT_BLTSTRETCHY 64
|
||||
#define SUPPORT_SSE 128
|
||||
#define SUPPORT_MMX 256
|
||||
|
||||
// <20><><EFBFBD>º궨<C2BA><EAB6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HIK_MEDIAINFO<46>ṹ
|
||||
#define FOURCC_HKMI 0x484B4D49 // "HKMI" HIK_MEDIAINFO<46>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD>
|
||||
// ϵͳ<CFB5><CDB3>װ<EFBFBD><D7B0>ʽ
|
||||
#define SYSTEM_NULL 0x0 // û<><C3BB>ϵͳ<CFB5>㣬<EFBFBD><E3A3AC><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>
|
||||
#define SYSTEM_HIK 0x1 // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
#define SYSTEM_MPEG2_PS 0x2 // PS<50><53>װ
|
||||
#define SYSTEM_MPEG2_TS 0x3 // TS<54><53>װ
|
||||
#define SYSTEM_RTP 0x4 // rtp<74><70>װ
|
||||
#define SYSTEM_RTPHIK 0x401 // rtp<74><70>װ
|
||||
|
||||
// <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define VIDEO_NULL 0x0 // û<><C3BB><EFBFBD><EFBFBD>Ƶ
|
||||
#define VIDEO_H264 0x1 // <20><>H.264<EFBFBD>ͺ<EFBFBD><EFBFBD><EFBFBD>H.264<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define VIDEO_MPEG2 0x2 // <20><>MPEG2
|
||||
#define VIDEO_MPEG4 0x3 // <20><>MPEG4
|
||||
#define VIDEO_MJPEG 0x4
|
||||
#define VIDEO_AVC264 0x0100
|
||||
|
||||
// <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define AUDIO_NULL 0x0000 // û<><C3BB><EFBFBD><EFBFBD>Ƶ
|
||||
#define AUDIO_ADPCM 0x1000 // ADPCM
|
||||
#define AUDIO_MPEG 0x2000 // MPEG ϵ<><CFB5><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>MPEG<45><47>Ƶ
|
||||
#define AUDIO_AAC 0x2001 // AAC
|
||||
#define AUDIO_RAW_DATA8 0x7000 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ8k<38><6B>ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>
|
||||
#define AUDIO_RAW_UDATA16 0x7001 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ16k<36><6B>ԭʼ<D4AD><CABC><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>L16
|
||||
// Gϵ<47><CFB5><EFBFBD><EFBFBD>Ƶ
|
||||
#define AUDIO_RAW_DATA8 0x7000 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ8k<38><6B>ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>
|
||||
#define AUDIO_RAW_UDATA16 0x7001 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ16k<36><6B>ԭʼ<D4AD><CABC><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>L16
|
||||
#define AUDIO_G711_U 0x7110
|
||||
#define AUDIO_G711_A 0x7111
|
||||
#define AUDIO_G722_1 0x7221
|
||||
#define AUDIO_G723_1 0x7231
|
||||
#define AUDIO_G726_U 0x7260
|
||||
#define AUDIO_G726_A 0x7261
|
||||
#define AUDIO_G726_16 0x7262
|
||||
#define AUDIO_G729 0x7290
|
||||
#define AUDIO_AMR_NB 0x3000
|
||||
|
||||
#define SYNCDATA_VEH 1 //ͬ<><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
#define SYNCDATA_IVS 2 //ͬ<><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
|
||||
//motion flow type
|
||||
#define MOTION_FLOW_NONE 0
|
||||
#define MOTION_FLOW_CPU 1
|
||||
#define MOTION_FLOW_GPU 2
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define ENCRYPT_AES_3R_VIDEO 1
|
||||
#define ENCRYPT_AES_10R_VIDEO 2
|
||||
#define ENCRYPT_AES_3R_AUDIO 1
|
||||
#define ENCRYPT_AES_10R_AUDIO 2
|
||||
|
||||
|
||||
#ifndef PLAYM4_ADDITION_INFO_TAG
|
||||
#define PLAYM4_ADDITION_INFO_TAG
|
||||
typedef struct _PLAYM4_ADDITION_INFO_ //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ṹ
|
||||
{
|
||||
unsigned char* pData; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned int dwDatalen; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
unsigned int dwDataType; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned int dwTimeStamp; //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>
|
||||
} PLAYM4_ADDITION_INFO;
|
||||
#endif
|
||||
|
||||
typedef struct tagSystemTime
|
||||
{
|
||||
short wYear;
|
||||
short wMonth;
|
||||
short wDayOfWeek;
|
||||
short wDay;
|
||||
short wHour;
|
||||
short wMinute;
|
||||
short wSecond;
|
||||
short wMilliseconds;
|
||||
}SYSTEMTIME;
|
||||
|
||||
typedef struct tagHKRect
|
||||
{
|
||||
unsigned long left;
|
||||
unsigned long top;
|
||||
unsigned long right;
|
||||
unsigned long bottom;
|
||||
}HKRECT;
|
||||
|
||||
//Frame position
|
||||
typedef struct
|
||||
{
|
||||
long long nFilePos;
|
||||
int nFrameNum;
|
||||
int nFrameTime;
|
||||
int nErrorFrameNum;
|
||||
SYSTEMTIME *pErrorTime;
|
||||
int nErrorLostFrameNum;
|
||||
int nErrorFrameSize;
|
||||
}FRAME_POS,*PFRAME_POS;
|
||||
|
||||
//Frame Info
|
||||
typedef struct
|
||||
{
|
||||
int nWidth;
|
||||
int nHeight;
|
||||
int nStamp;
|
||||
int nType;
|
||||
int nFrameRate;
|
||||
unsigned int dwFrameNum;
|
||||
}FRAME_INFO;
|
||||
|
||||
//Frame
|
||||
typedef struct
|
||||
{
|
||||
char *pDataBuf;
|
||||
int nSize;
|
||||
int nFrameNum;
|
||||
int bIsAudio;
|
||||
int nReserved;
|
||||
}FRAME_TYPE;
|
||||
|
||||
//Watermark Info //add by gb 080119
|
||||
typedef struct
|
||||
{
|
||||
char *pDataBuf;
|
||||
int nSize;
|
||||
int nFrameNum;
|
||||
int bRsaRight;
|
||||
int nReserved;
|
||||
}WATERMARK_INFO;
|
||||
|
||||
typedef struct SYNCDATA_INFO
|
||||
{
|
||||
unsigned int dwDataType; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ͣ<EFBFBD>Ŀǰ<C4BF>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
unsigned int dwDataLen; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
unsigned char* pData; //ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ݽṹ<DDBD><E1B9B9>ָ<EFBFBD><D6B8>,<2C><><EFBFBD><EFBFBD>IVS_INFO<46>ṹ
|
||||
} SYNCDATA_INFO;
|
||||
|
||||
#ifndef _HIK_MEDIAINFO_FLAG_
|
||||
#define _HIK_MEDIAINFO_FLAG_
|
||||
typedef struct _HIK_MEDIAINFO_ // modified by gb 080425
|
||||
{
|
||||
unsigned int media_fourcc; // "HKMI": 0x484B4D49 Hikvision Media Information
|
||||
unsigned short media_version; // <20>汾<EFBFBD>ţ<EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>Ϣ<EFBFBD>ṹ<EFBFBD>汾<EFBFBD>ţ<EFBFBD>ĿǰΪ0x0101,<2C><>1.01<EFBFBD>汾<EFBFBD><EFBFBD>01<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾<EFBFBD>ţ<EFBFBD>01<EFBFBD><EFBFBD><EFBFBD>Ӱ汾<EFBFBD>š<EFBFBD>
|
||||
unsigned short device_id; // <20>豸ID<49><44><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD>/<2F><><EFBFBD><EFBFBD>
|
||||
|
||||
unsigned short system_format; // ϵͳ<CFB5><CDB3>װ<EFBFBD><D7B0>
|
||||
unsigned short video_format; // <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
unsigned short audio_format; // <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char audio_channels; // ͨ<><CDA8><EFBFBD><EFBFBD>
|
||||
unsigned char audio_bits_per_sample; // <20><>λ<EFBFBD><CEBB>
|
||||
unsigned int audio_samplesrate; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned int audio_bitrate; // ѹ<><D1B9><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>,<2C><>λ<EFBFBD><CEBB>bit
|
||||
|
||||
unsigned int reserved[4]; // <20><><EFBFBD><EFBFBD>
|
||||
}HIK_MEDIAINFO;
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int nPort;
|
||||
char* pBuf;
|
||||
int nBufLen;
|
||||
int nWidth;
|
||||
int nHeight;
|
||||
int nStamp;
|
||||
int nType;
|
||||
void* nUser;
|
||||
}DISPLAY_INFO;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int nPort;
|
||||
char *pVideoBuf;
|
||||
int nVideoBufLen;
|
||||
char *pPriBuf;
|
||||
int nPriBufLen;
|
||||
int nWidth;
|
||||
int nHeight;
|
||||
int nStamp;
|
||||
int nType;
|
||||
void* nUser;
|
||||
}DISPLAY_INFOEX;
|
||||
|
||||
typedef struct PLAYM4_SYSTEM_TIME //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
{
|
||||
unsigned int dwYear; //<2F><>
|
||||
unsigned int dwMon; //<2F><>
|
||||
unsigned int dwDay; //<2F><>
|
||||
unsigned int dwHour; //ʱ
|
||||
unsigned int dwMin; //<2F><>
|
||||
unsigned int dwSec; //<2F><>
|
||||
unsigned int dwMs; //<2F><><EFBFBD><EFBFBD>
|
||||
} PLAYM4_SYSTEM_TIME;
|
||||
|
||||
#ifndef CROP_PIC_INFO_TAG
|
||||
#define CROP_PIC_INFO_TAG
|
||||
typedef struct
|
||||
{
|
||||
unsigned char* pDataBuf; //ץͼ<D7A5><CDBC><EFBFBD><EFBFBD>buffer
|
||||
unsigned int dwPicSize; //ʵ<><CAB5>ͼƬ<CDBC><C6AC>С
|
||||
unsigned int dwBufSize; //<2F><><EFBFBD><EFBFBD>buffer<65><72>С
|
||||
unsigned int dwPicWidth; //<2F><>ͼ<EFBFBD><CDBC>
|
||||
unsigned int dwPicHeight; //<2F><>ͼ<EFBFBD><CDBC>
|
||||
unsigned int dwReserve; //<2F><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>reserve<76>ֶ<EFBFBD>
|
||||
HKRECT* pCropRect; //ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>NULL, ͬ<>ϵ<EFBFBD>ץͼ<D7A5>ӿ<EFBFBD>
|
||||
}CROP_PIC_INFO;
|
||||
#endif
|
||||
|
||||
|
||||
//ENCRYPT Info
|
||||
typedef struct{
|
||||
long nVideoEncryptType; //<2F><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
long nAudioEncryptType; //<2F><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
long nSetSecretKey; //<2F>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ã<EFBFBD>1<EFBFBD><31>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ<EFBFBD><D4BF>0<EFBFBD><30>ʾû<CABE><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Կ
|
||||
}ENCRYPT_INFO;
|
||||
|
||||
// ˽<><CBBD><EFBFBD><EFBFBD>Ϣģ<CFA2><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
typedef enum _PLAYM4_PRIDATA_RENDER
|
||||
{
|
||||
PLAYM4_RENDER_ANA_INTEL_DATA = 0x00000001, //<2F><><EFBFBD>ܷ<EFBFBD><DCB7><EFBFBD>
|
||||
PLAYM4_RENDER_MD = 0x00000002, //<2F>ƶ<EFBFBD><C6B6><EFBFBD><EFBFBD><EFBFBD>
|
||||
PLAYM4_RENDER_ADD_POS = 0x00000004, //POS<4F><53>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
PLAYM4_RENDER_ADD_PIC = 0x00000008, //ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
PLAYM4_RENDER_FIRE_DETCET = 0x00000010, //<2F>ȳ<EFBFBD><C8B3><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
PLAYM4_RENDER_TEM = 0x00000020, //<2F>¶<EFBFBD><C2B6><EFBFBD>Ϣ
|
||||
}PLAYM4_PRIDATA_RENDER;
|
||||
|
||||
typedef enum _PLAYM4_FIRE_ALARM
|
||||
{
|
||||
PLAYM4_FIRE_FRAME_DIS = 0x00000001, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
||||
PLAYM4_FIRE_MAX_TEMP = 0x00000002, //<2F><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>
|
||||
PLAYM4_FIRE_MAX_TEMP_POSITION = 0x00000004, //<2F><><EFBFBD><EFBFBD><EFBFBD>¶<EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ʾ
|
||||
PLAYM4_FIRE_DISTANCE = 0x00000008, //<2F><><EFBFBD><EFBFBD><EFBFBD>¶Ⱦ<C2B6><C8BE><EFBFBD>
|
||||
}PLAYM4_FIRE_ALARM;
|
||||
|
||||
typedef enum _PLAYM4_TEM_FLAG
|
||||
{
|
||||
PLAYM4_TEM_REGION_BOX = 0x00000001, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
PLAYM4_TEM_REGION_LINE = 0x00000002, //<2F>߲<EFBFBD><DFB2><EFBFBD>
|
||||
PLAYM4_TEM_REGION_POINT = 0x00000004, //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}PLAYM4_TEM_FLAG;
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//API-Proposed Interface <20><><EFBFBD><EFBFBD>ʹ<EFBFBD>õĽӿ<C4BD>
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
///<<3C><>ʼ<EFBFBD><CABC>
|
||||
int PlayM4_GetPort(int* nPort);
|
||||
int PlayM4_FreePort(int nPort);
|
||||
int PlayM4_OpenFile(int nPort,char * sFileName);
|
||||
int PlayM4_CloseFile(int nPort);
|
||||
int PlayM4_SetStreamOpenMode(int nPort,unsigned int nMode);
|
||||
int PlayM4_GetStreamOpenMode(int nPort);
|
||||
int PlayM4_OpenStream(int nPort,unsigned char * pFileHeadBuf,unsigned int nSize,unsigned int nBufPoolSize);
|
||||
int PlayM4_CloseStream(int nPort);
|
||||
int PlayM4_InputData(int nPort,unsigned char * pBuf,unsigned int nSize);
|
||||
|
||||
///<<3C><><EFBFBD><EFBFBD>
|
||||
int PlayM4_SetFileRefCallBack(int nPort, void (CALLBACK *pFileRefDone)(unsigned int nPort,void* nUser),void* nUser);
|
||||
int PlayM4_GetRefValue(int nPort,unsigned char *pBuffer, unsigned int *pSize);
|
||||
int PlayM4_GetRefValueEx(int nPort,unsigned char *pBuffer, unsigned int *pSize);///<<3C><><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD>ͻص<CDBB>
|
||||
int PlayM4_SetRefValue(int nPort,unsigned char *pBuffer, unsigned int nSize);
|
||||
int PlayM4_GetKeyFramePos(int nPort,unsigned int nValue, unsigned int nType, PFRAME_POS pFramePos);
|
||||
int PlayM4_GetNextKeyFramePos(int nPort,unsigned int nValue, unsigned int nType, PFRAME_POS pFramePos);
|
||||
|
||||
///<<3C><><EFBFBD>ſ<EFBFBD><C5BF><EFBFBD>
|
||||
int PlayM4_Play(int nPort, PLAYM4_HWND hWnd);
|
||||
int PlayM4_Stop(int nPort);
|
||||
int PlayM4_Pause(int nPort,unsigned int nPause);
|
||||
int PlayM4_Fast(int nPort);
|
||||
int PlayM4_Slow(int nPort);
|
||||
int PlayM4_OneByOne(int nPort);
|
||||
int PlayM4_OneByOneBack(int nPort);
|
||||
int PlayM4_ReversePlay(int nPort);
|
||||
int PlayM4_RefreshPlay(int nPort);
|
||||
int PlayM4_RefreshPlayEx(int nPort, unsigned int nRegionNum);
|
||||
|
||||
///<<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int PlayM4_PlaySound(int nPort);
|
||||
int PlayM4_StopSound();
|
||||
int PlayM4_PlaySoundShare(int nPort);
|
||||
int PlayM4_StopSoundShare(int nPort);
|
||||
int PlayM4_SetVolume(int nPort,unsigned short nVolume);
|
||||
unsigned short PlayM4_GetVolume(int nPort);
|
||||
|
||||
///<<3C><>ȡ<EFBFBD><C8A1>Ϣ
|
||||
int PlayM4_SetPlayPos(int nPort,float fRelativePos);
|
||||
float PlayM4_GetPlayPos(int nPort);
|
||||
unsigned int PlayM4_GetFileTime(int nPort);
|
||||
unsigned int PlayM4_GetPlayedTime(int nPort);
|
||||
unsigned int PlayM4_GetPlayedFrames(int nPort);
|
||||
unsigned int PlayM4_GetFileTotalFrames(int nPort);
|
||||
unsigned int PlayM4_GetCurrentFrameRate(int nPort);
|
||||
unsigned int PlayM4_GetPlayedTimeEx(int nPort);
|
||||
int PlayM4_SetPlayedTimeEx(int nPort,unsigned int nTime);
|
||||
unsigned int PlayM4_GetCurrentFrameNum(int nPort);
|
||||
int PlayM4_SetCurrentFrameNum(int nPort,unsigned int nFrameNum);
|
||||
int PlayM4_GetSystemTime(int nPort, PLAYM4_SYSTEM_TIME *pstSystemTime);
|
||||
unsigned int PlayM4_GetSpecialData(int nPort);
|
||||
int PlayM4_GetPictureSize(int nPort,int *pWidth,int *pHeight);
|
||||
int PlayM4_SetFileEndCallback(int nPort, void(CALLBACK*FileEndCallback)(int nPort, void *pUser), void *pUser);
|
||||
|
||||
///<<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned int PlayM4_GetSourceBufferRemain(int nPort);
|
||||
int PlayM4_ResetSourceBuffer(int nPort);
|
||||
int PlayM4_ResetBuffer(int nPort,unsigned int nBufType);
|
||||
unsigned int PlayM4_GetBufferValue(int nPort,unsigned int nBufType);
|
||||
int PlayM4_SetDisplayBuf(int nPort, unsigned int nNum);
|
||||
unsigned int PlayM4_GetDisplayBuf(int nPort);
|
||||
|
||||
///<ץͼ
|
||||
int PlayM4_SetJpegQuality(int nQuality);
|
||||
int PlayM4_GetBMP(int nPort,unsigned char * pBitmap,unsigned int nBufSize,unsigned int* pBmpSize);
|
||||
int PlayM4_GetJPEG(int nPort,unsigned char * pJpeg,unsigned int nBufSize,unsigned int* pJpegSize);
|
||||
int PlayM4_ConvertToBmpFile(char * pBuf,int nSize,int nWidth,int nHeight,int nType,char *sFileName);
|
||||
int PlayM4_ConvertToJpegFile(char * pBuf,int nSize,int nWidth,int nHeight,int nType,char *sFileName);
|
||||
|
||||
///<<3C><><EFBFBD><EFBFBD>
|
||||
int PlayM4_SetSecretKey(int nPort, int lKeyType, char *pSecretKey, int lKeyLen);
|
||||
int PlayM4_ThrowBFrameNum(int nPort,unsigned int nNum);
|
||||
int PlayM4_SetDecCBStream(int nPort,unsigned int nStream);
|
||||
int PlayM4_SetDecodeFrameType(int nPort,unsigned int nFrameType);
|
||||
int PlayM4_SkipErrorData(int nPort, int bSkip);
|
||||
int PlayM4_SetDecCallBackMend(int nPort,void (CALLBACK* DecCBFun)(int nPort,char * pBuf,int nSize,FRAME_INFO * pFrameInfo, void* nUser,int nReserved2), void* nUser);
|
||||
int PlayM4_SetDecCallBackExMend(int nPort, void (CALLBACK* DecCBFun)(int nPort, char* pBuf, int nSize, FRAME_INFO* pFrameInfo, void* nUser, int nReserved2), char* pDest, int nDestSize, void* nUser);
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>,nType=0<><30>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>仯<EFBFBD>ͻص<CDBB><D8B5><EFBFBD>nType=1<><31>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC><EFBFBD>λ<EFBFBD><CEBB><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD>
|
||||
int PlayM4_SetEncryptTypeCallBack(int nPort, unsigned int nType, void (CALLBACK* EncryptTypeCBFun)(int nPort, ENCRYPT_INFO* pEncryptInfo, void* nUser, int nReserved2), void* nUser);
|
||||
|
||||
///<<3C><>ʾ
|
||||
int PlayM4_SetDisplayRegion(int nPort,unsigned int nRegionNum, HKRECT *pSrcRect, PLAYM4_HWND hDestWnd, int bEnable);///<<3C><><EFBFBD>ӷŴ<D3B7>
|
||||
int PlayM4_SetDisplayRegionOnWnd(int nPort,unsigned int nRegionNum, HKRECT *pSrcRect, int bEnable);///<<3C>ര<EFBFBD>ڷָ<DAB7><D6B8>ӿ<EFBFBD>
|
||||
int PlayM4_SetDisplayCallBack(int nPort,void (CALLBACK* DisplayCBFun)(int nPort,char * pBuf,int nSize,int nWidth,int nHeight,int nStamp,int nType,int nReserved));
|
||||
int PlayM4_SetDisplayCallBackEx(int nPort,void (CALLBACK* DisplayCBFun)(DISPLAY_INFO *pstDisplayInfo), void* nUser);
|
||||
int PlayM4_RegisterDrawFun(int nPort,void (CALLBACK* DrawFun)(int nPort,PLAYM4_HDC hDc,void* nUser),void* nUser);
|
||||
int PlayM4_SetEncTypeChangeCallBack(int nPort, void(CALLBACK *funEncChange)(int nPort, void* nUser), void* nUser);
|
||||
int PlayM4_SetCheckWatermarkCallBack(int nPort, void(CALLBACK* funCheckWatermark)(int nPort, WATERMARK_INFO* pWatermarkInfo, void* nUser), void* nUser);
|
||||
int PlayM4_SetDisplayType(int nPort, int nType);
|
||||
int PlayM4_GetDisplayType(int nPort);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||||
PLAYM4_API int __stdcall PlayM4_RenderPrivateData(int nPort, int nIntelType, int bTrue);
|
||||
PLAYM4_API int __stdcall PlayM4_RenderPrivateDataEx(int nPort, int nIntelType, int nSubType, int bTrue);
|
||||
PLAYM4_API int __stdcall PlayM4_SetConfigFontPath(int nPort, char* pFontPath);///<<3C><><EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>·<EFBFBD><C2B7>-playǰ<79><C7B0><EFBFBD><EFBFBD>
|
||||
|
||||
//lType: 1 <20><>ʾ<EFBFBD><CABE>ȡ<EFBFBD><C8A1>ǰ<EFBFBD><C7B0>ʾ֡PTZ<54><5A>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD><D8B6>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD>ʽ<EFBFBD>洢<EFBFBD><E6B4A2>pInfo<66>ڣ<EFBFBD>plLen<65><6E><EFBFBD>س<EFBFBD><D8B3><EFBFBD><EFBFBD><EFBFBD>Ϣ;<3B><><EFBFBD>ȴ<EFBFBD><C8B4><EFBFBD>pInfo = null<6C><6C><EFBFBD><EFBFBD><EFBFBD>Ի<EFBFBD>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ泤<DAB4><E6B3A4>plLen
|
||||
PLAYM4_API int __stdcall PlayM4_GetStreamAdditionalInfo(int nPort, int lType, unsigned char* pInfo, int* plLen);
|
||||
|
||||
///<ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define R_ANGLE_0 -1 //<2F><><EFBFBD><EFBFBD>ת
|
||||
#define R_ANGLE_L90 0 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת90<39><30>
|
||||
#define R_ANGLE_R90 1 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת90<39><30>
|
||||
#define R_ANGLE_180 2 //<2F><>ת180<38><30>
|
||||
|
||||
PLAYM4_API int __stdcall PlayM4_SetRotateAngle(int nPort, unsigned int nRegionNum, unsigned int dwType);
|
||||
|
||||
///<<3C><><EFBFBD><EFBFBD>
|
||||
unsigned int PlayM4_GetFileHeadLength();
|
||||
unsigned int PlayM4_GetSdkVersion();
|
||||
unsigned int PlayM4_GetLastError(int nPort);
|
||||
//dwGroupIndex <20><>Լ<EFBFBD><D4BC>ȡֵ0~3<><33><EFBFBD><EFBFBD>һ<EFBFBD>汾ȡ<E6B1BE><C8A1>ͬ<EFBFBD><CDAC>ֻ<EFBFBD><D6BB>ͬ<EFBFBD><CDAC>closestream<61><6D><EFBFBD><EFBFBD>
|
||||
PLAYM4_API int __stdcall PlayM4_SetSycGroup(int nPort, unsigned int dwGroupIndex);
|
||||
|
||||
///<SDPȡ<50><C8A1><EFBFBD>ӿ<EFBFBD>//////////////////////////////////////////////////////////////////////////
|
||||
#ifndef PLAYM4_SESSION_INFO_TAG
|
||||
#define PLAYM4_SESSION_INFO_TAG
|
||||
//nProtocolType
|
||||
#define PLAYM4_PROTOCOL_RTSP 1
|
||||
//nSessionInfoType
|
||||
#define PLAYM4_SESSION_INFO_SDP 1
|
||||
|
||||
typedef struct _PLAYM4_SESSION_INFO_ //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ṹ
|
||||
{
|
||||
int nSessionInfoType; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD>ʱֻ֧<D6BB><D6A7>SDP
|
||||
int nSessionInfoLen; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||||
unsigned char* pSessionInfoData; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||||
|
||||
} PLAYM4_SESSION_INFO;
|
||||
#endif
|
||||
|
||||
PLAYM4_API int __stdcall PlayM4_OpenStreamAdvanced(int nPort, int nProtocolType, PLAYM4_SESSION_INFO* pstSessionInfo, unsigned int nBufPoolSize);
|
||||
|
||||
///<<3C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؽӿ<D8BD>//////////////////////////////////////////////////////////////////////////
|
||||
#ifndef FISH_EYE_TAG
|
||||
#define FISH_EYE_TAG
|
||||
|
||||
// <20><>װ<EFBFBD><D7B0><EFBFBD><EFBFBD>
|
||||
typedef enum tagFECPlaceType
|
||||
{
|
||||
FEC_PLACE_WALL = 0x1, // <20><>װ<EFBFBD><D7B0>ʽ (<28><><EFBFBD><EFBFBD>ˮƽ)
|
||||
FEC_PLACE_FLOOR = 0x2, // <20><><EFBFBD>氲װ (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
FEC_PLACE_CEILING = 0x3, // <20><>װ<EFBFBD><D7B0>ʽ (<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
|
||||
|
||||
}FECPLACETYPE;
|
||||
|
||||
typedef enum tagFECCorrectType
|
||||
{
|
||||
FEC_CORRECT_NULL = 0x0, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
FEC_CORRECT_PTZ = 0x100, // PTZ
|
||||
FEC_CORRECT_180 = 0x200, // 180<38>Ƚ<EFBFBD><C8BD><EFBFBD> <20><><EFBFBD><EFBFBD>Ӧ2P<32><50>
|
||||
FEC_CORRECT_360 = 0x300, // 360ȫ<30><C8AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>Ӧ1P<31><50>
|
||||
FEC_CORRECT_LAT = 0x400 // γ<><CEB3>չ<EFBFBD><D5B9>
|
||||
|
||||
}FECCORRECTTYPE;
|
||||
|
||||
typedef struct tagCycleParam
|
||||
{
|
||||
float fRadiusLeft; // Բ<><D4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD>
|
||||
float fRadiusRight; // Բ<><D4B2><EFBFBD><EFBFBD><EFBFBD>ұ<EFBFBD>X<EFBFBD><58><EFBFBD><EFBFBD>
|
||||
float fRadiusTop; // Բ<><D4B2><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD>
|
||||
float fRadiusBottom; // Բ<><D4B2><EFBFBD><EFBFBD><EFBFBD>±<EFBFBD>Y<EFBFBD><59><EFBFBD><EFBFBD>
|
||||
|
||||
}CYCLEPARAM;
|
||||
|
||||
typedef struct tagPTZParam
|
||||
{
|
||||
float fPTZPositionX; // PTZ <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB> X<><58><EFBFBD><EFBFBD>
|
||||
float fPTZPositionY; // PTZ <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB> Y<><59><EFBFBD><EFBFBD>
|
||||
|
||||
}PTZPARAM;
|
||||
|
||||
// <20><><EFBFBD>±<EFBFBD><C2B1>DZ<EFBFBD><C7B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
#define FEC_UPDATE_RADIUS 0x1
|
||||
#define FEC_UPDATE_PTZZOOM 0x2
|
||||
#define FEC_UPDATE_WIDESCANOFFSET 0x4
|
||||
#define FEC_UPDATE_PTZPARAM 0x8
|
||||
#define FEC_UPDATT_PTZCOLOR 0x10
|
||||
|
||||
|
||||
// ɫ<>ʽṹ<CABD><E1B9B9>
|
||||
typedef struct tagFECColor
|
||||
{
|
||||
unsigned char nR; // R<><52><EFBFBD><EFBFBD>
|
||||
unsigned char nG; // G<><47><EFBFBD><EFBFBD>
|
||||
unsigned char nB; // B<><42><EFBFBD><EFBFBD>
|
||||
unsigned char nAlpha; // Alpha<68><61><EFBFBD><EFBFBD>
|
||||
}FECCOLOR;
|
||||
|
||||
typedef struct tagFECParam
|
||||
{
|
||||
unsigned int nUpDateType; // <20><><EFBFBD>µ<EFBFBD><C2B5><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
unsigned int nPlaceAndCorrect; // <20><>װ<EFBFBD><D7B0>ʽ<EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><CABD>ֻ<EFBFBD><D6BB><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD>ȡ<EFBFBD><C8A1>SetParam<61><6D>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>Ч,<2C><>ֵ<EFBFBD><D6B5>ʾ<EFBFBD><CABE>װ<EFBFBD><D7B0>ʽ<EFBFBD>ͽ<EFBFBD><CDBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD>ĺ<EFBFBD>
|
||||
|
||||
PTZPARAM stPTZParam; // PTZ У<><D0A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
|
||||
|
||||
CYCLEPARAM stCycleParam; // <20><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC>Բ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
|
||||
|
||||
float fZoom; // PTZ <20><>ʾ<EFBFBD>ķ<EFBFBD>Χ<EFBFBD><CEA7><EFBFBD><EFBFBD>
|
||||
|
||||
float fWideScanOffset; // 180<38><30><EFBFBD><EFBFBD>360<36><30>У<EFBFBD><D0A3><EFBFBD><EFBFBD>ƫ<EFBFBD>ƽǶ<C6BD>
|
||||
FECCOLOR stPTZColor; // PTZ<54><5A>ɫ
|
||||
int nResver[15]; // <20><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>
|
||||
|
||||
}FISHEYEPARAM;
|
||||
|
||||
// PTZ<54><5A>ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾģʽ
|
||||
typedef enum tagFECShowMode
|
||||
{
|
||||
FEC_PTZ_OUTLINE_NULL, // <20><><EFBFBD><EFBFBD>ʾ
|
||||
FEC_PTZ_OUTLINE_RECT, // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
||||
FEC_PTZ_OUTLINE_RANGE, // <20><>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ
|
||||
}FECSHOWMODE;
|
||||
|
||||
#define FEC_JPEG 0 // JPEGץͼ
|
||||
#define FEC_BMP 1 // BMP ץͼ
|
||||
|
||||
typedef void (__stdcall * FISHEYE_CallBack )(void* pUser, unsigned int nPort, unsigned int nCBType, void * hDC, unsigned int nWidth, unsigned int nHeight);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
PLAYM4_API int __stdcall PlayM4_FEC_Enable(int nPort);
|
||||
|
||||
// <20>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
||||
PLAYM4_API int __stdcall PlayM4_FEC_Disable(int nPort);
|
||||
|
||||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD>۽<EFBFBD><DBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ˿<D3B6> [1~31]
|
||||
PLAYM4_API int __stdcall PlayM4_FEC_GetPort(int nPort , unsigned int* nSubPort , FECPLACETYPE emPlaceType , FECCORRECTTYPE emCorrectType);
|
||||
|
||||
// ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD>۽<EFBFBD><DBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӷ˿<D3B6>
|
||||
PLAYM4_API int __stdcall PlayM4_FEC_DelPort(int nPort , unsigned int nSubPort);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۽<EFBFBD><DBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
PLAYM4_API int __stdcall PlayM4_FEC_SetParam(int nPort , unsigned int nSubPort , FISHEYEPARAM * pPara);
|
||||
|
||||
// <20><>ȡ<EFBFBD><C8A1><EFBFBD>۽<EFBFBD><DBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
PLAYM4_API int __stdcall PlayM4_FEC_GetParam(int nPort , unsigned int nSubPort , FISHEYEPARAM * pPara);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>л<EFBFBD>
|
||||
PLAYM4_API int __stdcall PlayM4_FEC_SetWnd(int nPort , unsigned int nSubPort , void * hWnd);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>۴<EFBFBD><DBB4>ڵĻ<DAB5>ͼ<EFBFBD>ص<EFBFBD>
|
||||
PLAYM4_API int __stdcall PlayM4_FEC_SetCallBack(int nPort , unsigned int nSubPort , FISHEYE_CallBack cbFunc , void * pUser);
|
||||
|
||||
// <20><><EFBFBD><EFBFBD>ץͼ
|
||||
PLAYM4_API int __stdcall PlayM4_FEC_Capture(int nPort, unsigned int nSubPort, unsigned int nType, char* pFileName);
|
||||
|
||||
PLAYM4_API int __stdcall PlayM4_FEC_GetCurrentPTZPort(int nPort, float fPositionX,float fPositionY, unsigned int *pnPort);
|
||||
|
||||
PLAYM4_API int __stdcall PlayM4_FEC_SetCurrentPTZPort(int nPort, unsigned int nSubPort);
|
||||
|
||||
PLAYM4_API int __stdcall PlayM4_FEC_SetPTZOutLineShowMode(int nPort,FECSHOWMODE nPTZShowMode);
|
||||
|
||||
|
||||
//ͼ<><CDBC><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF><EFBFBD>صĽӿ<C4BD>--Unsupported Interface <20><><EFBFBD>ܲ<EFBFBD>֧<EFBFBD><D6A7>//////////////////////////////////////////////////////////////////////////
|
||||
#ifndef PLAYM4_HIKVIE_TAG
|
||||
#define PLAYM4_HIKVIE_TAG
|
||||
|
||||
typedef struct _PLAYM4_VIE_DYNPARAM_
|
||||
{
|
||||
int moduFlag; //<2F><><EFBFBD>õ<EFBFBD><C3B5>㷨<EFBFBD><E3B7A8><EFBFBD><EFBFBD>ģ<EFBFBD>飬<EFBFBD><E9A3AC>PLAYM4_VIE_MODULES<45>ж<EFBFBD><D0B6><EFBFBD>
|
||||
//<2F><> PLAYM4_VIE_MODU_ADJ | PLAYM4_VIE_MODU_EHAN
|
||||
//ģ<><C4A3><EFBFBD><EFBFBD><EFBFBD>ú<C3BA><F3A3ACB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD>
|
||||
//PLAYM4_VIE_MODU_ADJ
|
||||
int brightVal; //<2F><><EFBFBD>ȵ<EFBFBD><C8B5><EFBFBD>ֵ<EFBFBD><D6B5>[-255, 255]
|
||||
int contrastVal; //<2F>Աȶȵ<C8B6><C8B5><EFBFBD>ֵ<EFBFBD><D6B5>[-256, 255]
|
||||
int colorVal; //<2F><><EFBFBD>Ͷȵ<CDB6><C8B5><EFBFBD>ֵ<EFBFBD><D6B5>[-256, 255]
|
||||
//PLAYM4_VIE_MODU_EHAN
|
||||
int toneScale; //<2F>˲<EFBFBD><CBB2><EFBFBD>Χ<EFBFBD><CEA7>[0, 100]
|
||||
int toneGain; //<2F>Աȶȵ<C8B6><C8B5>ڣ<EFBFBD>ȫ<EFBFBD>ֶԱȶ<D4B1><C8B6><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>[-256, 255]
|
||||
int toneOffset; //<2F><><EFBFBD>ȵ<EFBFBD><C8B5>ڣ<EFBFBD><DAA3><EFBFBD><EFBFBD><EFBFBD>ƽ<EFBFBD><C6BD>ֵƫ<D6B5>ƣ<EFBFBD>[-255, 255]
|
||||
int toneColor; //<2F><>ɫ<EFBFBD><C9AB><EFBFBD>ڣ<EFBFBD><DAA3><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>[-256, 255]
|
||||
//PLAYM4_VIE_MODU_DEHAZE
|
||||
int dehazeLevel; //ȥ<><C8A5>ǿ<EFBFBD>ȣ<EFBFBD>[0, 255]
|
||||
int dehazeTrans; //<><CDB8>ֵ<EFBFBD><D6B5>[0, 255]
|
||||
int dehazeBright; //<2F><><EFBFBD>Ȳ<EFBFBD><C8B2><EFBFBD><EFBFBD><EFBFBD>[0, 255]
|
||||
//PLAYM4_VIE_MODU_DENOISE
|
||||
int denoiseLevel; //ȥ<><C8A5>ǿ<EFBFBD>ȣ<EFBFBD>[0, 255]
|
||||
//PLAYM4_VIE_MODU_SHARPEN
|
||||
int usmAmount; //<2F><><EFBFBD><EFBFBD>ǿ<EFBFBD>ȣ<EFBFBD>[0, 255]
|
||||
int usmRadius; //<2F>뾶<F1BBAFB0><EBBEB6>[1, 15]
|
||||
int usmThreshold; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><D6B5>[0, 255]
|
||||
//PLAYM4_VIE_MODU_DEBLOCK
|
||||
int deblockLevel; //ȥ<><C8A5>ǿ<EFBFBD>ȣ<EFBFBD>[0, 100]
|
||||
//PLAYM4_VIE_MODU_LENS
|
||||
int lensWarp; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[-256, 255]
|
||||
int lensZoom; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>[-256, 255]
|
||||
//PLAYM4_VIE_MODU_CRB
|
||||
//<2F><><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>
|
||||
} PLAYM4_VIE_PARACONFIG;
|
||||
|
||||
typedef enum _PLAYM4_VIE_MODULES
|
||||
{
|
||||
PLAYM4_VIE_MODU_ADJ = 0x00000001, //ͼ<><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
PLAYM4_VIE_MODU_EHAN = 0x00000002, //<2F>ֲ<EFBFBD><D6B2><EFBFBD>ǿģ<C7BF><C4A3>
|
||||
PLAYM4_VIE_MODU_DEHAZE = 0x00000004, //ȥ<><C8A5>ģ<EFBFBD><C4A3>
|
||||
PLAYM4_VIE_MODU_DENOISE = 0x00000008, //ȥ<><C8A5>ģ<EFBFBD><C4A3>
|
||||
PLAYM4_VIE_MODU_SHARPEN = 0x00000010, //<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
||||
PLAYM4_VIE_MODU_DEBLOCK = 0x00000020, //ȥ<><C8A5><EFBFBD>˲<EFBFBD>ģ<EFBFBD><C4A3>
|
||||
PLAYM4_VIE_MODU_CRB = 0x00000040, //ɫ<><C9AB>ƽ<EFBFBD><C6BD>ģ<EFBFBD><C4A3>
|
||||
PLAYM4_VIE_MODU_LENS = 0x00000080, //<2F><>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
||||
}PLAYM4_VIE_MODULES;
|
||||
#endif
|
||||
|
||||
//<2F><><EFBFBD>ùر<C3B9>/<2F><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
||||
//dwModuFlag<61><67>ӦPLAYM4_VIE_MODULES<45><53>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD>鿪<EFBFBD><E9BFAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڼ<EFBFBD><DABC><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD>ϵIJ<CFB5><C4B2><EFBFBD>;
|
||||
//<2F>ر<EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϴ<EFBFBD><CFB4><EFBFBD><EFBFBD>õIJ<C3B5><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD>ӿڵ<D3BF><DAB5>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڸýӿڿ<D3BF><DABF><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><F3A3BBB7><EFBFBD><F2A3ACB7>ش<EFBFBD><D8B4><EFBFBD>
|
||||
PLAYM4_API int __stdcall PlayM4_VIE_SetModuConfig(int nPort, int nModuFlag, int bEnable);
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>ͼ<EFBFBD><CDBC><EFBFBD><EFBFBD>ǿ<EFBFBD><C7BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>NULLȫͼ<C8AB><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫͼ<C8AB><CDBC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫͼ<C8AB><CDBC><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>16*16<31><36><EFBFBD><EFBFBD>
|
||||
//<2F><>֧<EFBFBD><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƚ<EFBFBD>˵4<CBB5><34><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>汾<EFBFBD><E6B1BE><EFBFBD><EFBFBD>ֻ֧<D6BB><D6A7>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5>ͱ<EFBFBD><CDB1><EFBFBD>
|
||||
PLAYM4_API int __stdcall PlayM4_VIE_SetRegion(int nPort, int nRegNum, HKRECT* pRect);
|
||||
|
||||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
||||
PLAYM4_API int __stdcall PlayM4_VIE_GetModuConfig(int nPort, int* pdwModuFlag);
|
||||
|
||||
//<2F><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>
|
||||
//δ<><CEB4><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD><EFBFBD><EFBFBD>
|
||||
PLAYM4_API int __stdcall PlayM4_VIE_SetParaConfig(int nPort, PLAYM4_VIE_PARACONFIG* pParaConfig);
|
||||
|
||||
//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD>
|
||||
PLAYM4_API int __stdcall PlayM4_VIE_GetParaConfig(int nPort, PLAYM4_VIE_PARACONFIG* pParaConfig);
|
||||
|
||||
|
||||
|
||||
|
||||
#define PLAYM4_MEDIA_HEAD 1 //ϵͳͷ<CDB3><CDB7><EFBFBD><EFBFBD>
|
||||
#define PLAYM4_VIDEO_DATA 2 //<2F><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define PLAYM4_AUDIO_DATA 3 //<2F><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define PLAYM4_PRIVT_DATA 4 //˽<><CBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
//Ԥ¼<D4A4><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ--Unsupported Interface <20><><EFBFBD>ܲ<EFBFBD>֧<EFBFBD><D6A7>////////////////////////
|
||||
typedef struct
|
||||
{
|
||||
long nType; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>ļ<EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>˽<EFBFBD><CBBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>
|
||||
long nStamp; // ʱ<><CAB1><EFBFBD><EFBFBD>
|
||||
long nFrameNum; // ֡<><D6A1>
|
||||
long nBufLen; // <20><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
char* pBuf; // ֡<><D6A1><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>֡Ϊ<D6A1><CEAA>λ<EFBFBD>ص<EFBFBD>
|
||||
PLAYM4_SYSTEM_TIME stSysTime; // ȫ<><C8AB>ʱ<EFBFBD><CAB1>
|
||||
}RECORD_DATA_INFO;
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>Ԥ¼<D4A4>أ<F1BFAAB9>bFlag=1<><31><EFBFBD><EFBFBD><EFBFBD><EFBFBD>bFlag=0<>ر<EFBFBD>
|
||||
PLAYM4_API int __stdcall PlayM4_SetPreRecordFlag(int nPort, int bFlag);
|
||||
|
||||
//Ԥ¼<D4A4><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻص<DDBB>
|
||||
PLAYM4_API int __stdcall PlayM4_SetPreRecordCallBack(int nPort, void (CALLBACK* PreRecordCBfun)(int nPort, RECORD_DATA_INFO* pRecordDataInfo, void* pUser), void* pUser);
|
||||
|
||||
|
||||
typedef struct
|
||||
{
|
||||
long lDataType; //˽<><CBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
long lDataStrVersion; //<2F><><EFBFBD>ݷ<EFBFBD><DDB7>صĽṹ<C4BD><E1B9B9><EFBFBD>汾<EFBFBD><E6B1BE><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>Ϊ<EFBFBD>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD>
|
||||
long lDataTimeStamp;
|
||||
long lDataLength;
|
||||
char* pData;
|
||||
}AdditionDataInfo;
|
||||
|
||||
PLAYM4_API int __stdcall PlayM4_SetAdditionDataCallBack(int nPort, unsigned int nSyncType, void (CALLBACK* AdditionDataCBFun)(int nPort, AdditionDataInfo* pstAddDataInfo, void* pUser), void* pUser);
|
||||
|
||||
///<ʵʱ<CAB5><CAB1>Ϣ<EFBFBD>ص<EFBFBD>
|
||||
#define PLAYM4_SOURCE_MODULE 0 // <20><><EFBFBD><EFBFBD>Դģ<D4B4><C4A3>
|
||||
#define PLAYM4_DEMUX_MODULE 1 // <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
||||
#define PLAYM4_DECODE_MODULE 2 // <20><><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
||||
#define PLAYM4_RENDER_MODULE 3 // <20><>Ⱦģ<C8BE><C4A3>
|
||||
|
||||
#define PLAYM4_RTINFO_SOFTDECODE_ERROR 1 // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define PLAYM4_RTINFO_MEDIAHEADER_ERROR 2 // ý<><C3BD>ͷ<EFBFBD><CDB7><EFBFBD><EFBFBD>
|
||||
#define PLAYM4_RTINFO_ALLOC_MEMORY_ERROR 4 // <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int nRunTimeModule; //<2F><>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3>
|
||||
int nStrVersion; //<2F><><EFBFBD>ݷ<EFBFBD><DDB7>صĽṹ<C4BD><E1B9B9><EFBFBD>汾<EFBFBD><E6B1BE><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>Ϊ<EFBFBD>˼<EFBFBD><CBBC><EFBFBD><EFBFBD><EFBFBD>,<2C><>һ<EFBFBD><D2BB><EFBFBD>汾<EFBFBD><E6B1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0x0001
|
||||
int nFrameTimeStamp; //֡<><D6A1>
|
||||
int nFrameNum; //ʱ<><CAB1><EFBFBD><EFBFBD>
|
||||
int nErrorCode; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char reserved[12]; //<2F><><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>
|
||||
}RunTimeInfo;
|
||||
|
||||
PLAYM4_API int __stdcall PlayM4_SetRunTimeInfoCallBackEx(int nPort, int nModule, void (CALLBACK* RunTimeInfoCBFun)(int nPort, RunTimeInfo* pstRunTimeInfo, void* pUser), void* pUser);
|
||||
|
||||
|
||||
///<<3C><><EFBFBD>ڴ<EFBFBD>С<EFBFBD>ı<EFBFBD>֪ͨ<CDA8>ӿ<EFBFBD>
|
||||
PLAYM4_API int __stdcall PlayM4_WndResolutionChange(int nPort);//new add
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//Unproposed Interface <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>õĽӿ<C4BD>
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
int PlayM4_RigisterDrawFun(int nPort,void (CALLBACK* DrawFun)(int nPort,PLAYM4_HDC hDc,void* nUser),void* nUser);
|
||||
int PlayM4_SetDecCallBack(int nPort,void (CALLBACK* DecCBFun)(int nPort,char* pBuf,int nSize,FRAME_INFO * pFrameInfo, void* nReserved1,int nReserved2));
|
||||
int PlayM4_SetDecCallBackEx(int nPort,void (CALLBACK* DecCBFun)(int nPort,char * pBuf,int nSize,FRAME_INFO * pFrameInfo, void* nReserved1,int nReserved2), char* pDest, int nDestSize);
|
||||
int PlayM4_SetVideoWindow(int nPort, unsigned int nRegionNum, PLAYM4_HWND hWnd);
|
||||
int PlayM4_SetColor(int nPort, unsigned int nRegionNum, int nBrightness, int nContrast, int nSaturation, int nHue);
|
||||
int PlayM4_GetColor(int nPort, unsigned int nRegionNum, int* pBrightness, int* pContrast, int* pSaturation, int* pHue);
|
||||
int PlayM4_GetFileTimeEx(int nPort, unsigned int* pStart, unsigned int* pStop, unsigned int* pRev);
|
||||
int PlayM4_GetCurrentFrameRateEx(int nPort, float* pfFrameRate);
|
||||
int PlayM4_SyncToAudio(int nPort, int bSyncToAudio);
|
||||
int PlayM4_SetImageSharpen(int nPort, unsigned int nLevel);
|
||||
int PlayM4_ResetSourceBufFlag(int nPort);
|
||||
int PlayM4_SetSourceBufCallBack(int nPort, unsigned int nThreShold, void (CALLBACK* SourceBufCallBack)(int nPort, unsigned int nBufSize, unsigned int dwUser, void* pResvered), unsigned int dwUser, void* pReserved);
|
||||
unsigned int PlayM4_GetAbsFrameNum(int nPort);
|
||||
PLAYM4_API int __stdcall PlayM4_SetRunTimeInfoCallBack(int nPort, void (CALLBACK* RunTimeInfoCBFun)(int nPort, RunTimeInfo* pstRunTimeInfo, void* pUser), void* pUser);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
////////////////NO SUPPORT///////////////////////////////////////////////////
|
||||
|
||||
int PlayM4_InitDDraw(PLAYM4_HWND hWnd);
|
||||
int PlayM4_RealeseDDraw();
|
||||
#if (WINVER >= 0x0400)
|
||||
//Note: These funtion must be builded under win2000 or above with Microsoft Platform sdk.
|
||||
//You can download the sdk from "http://www.microsoft.com/msdownload/platformsdk/sdkupdate/";
|
||||
int PlayM4_InitDDrawDevice();
|
||||
void PlayM4_ReleaseDDrawDevice();
|
||||
int PlayM4_SetDDrawDevice(int nPort, unsigned int nDeviceNum);
|
||||
int PlayM4_SetDDrawDeviceEx(int nPort,unsigned int nRegionNum,unsigned int nDeviceNum);
|
||||
int PlayM4_GetDDrawDeviceInfo(unsigned int nDeviceNum, char* lpDriverDescription, unsigned int nDespLen, char* lpDriverName, unsigned int nNameLen, HMONITOR* hhMonitor);
|
||||
int PlayM4_GetCapsEx(unsigned int nDDrawDeviceNum);
|
||||
unsigned int PlayM4_GetDDrawDeviceTotalNums();
|
||||
#endif
|
||||
int PlayM4_SetFileEndMsg(int nPort, PLAYM4_HWND hWnd, unsigned int nMsg);
|
||||
int PlayM4_GetCaps();
|
||||
int PlayM4_OpenStreamEx(int nPort, unsigned char* pFileHeadBuf, unsigned int nSize, unsigned int nBufPoolSize);
|
||||
int PlayM4_CloseStreamEx(int nPort);
|
||||
int PlayM4_InputVideoData(int nPort, unsigned char* pBuf, unsigned int nSize);
|
||||
int PlayM4_InputAudioData(int nPort, unsigned char* pBuf, unsigned int nSize);
|
||||
//int PlayM4_SetOverlayMode(int nPort, int bOverlay, COLORREF colorKey);
|
||||
int PlayM4_GetOverlayMode(int nPort);
|
||||
int PlayM4_SetOverlayFlipMode(int nPort, int bTrue);
|
||||
//COLORREF PlayM4_GetColorKey(int nPort);
|
||||
int PlayM4_SetPicQuality(int nPort, int bHighQuality);
|
||||
int PlayM4_GetPictureQuality(int nPort, int* bHighQuality);
|
||||
int PlayM4_AdjustWaveAudio(int nPort, int nCoefficient);
|
||||
int PlayM4_SetPlayMode(int nPort, int bNormal);
|
||||
int PlayM4_SetDeflash(int nPort, int bDefalsh);
|
||||
int PlayM4_CheckDiscontinuousFrameNum(int nPort, int bCheck);
|
||||
int PlayM4_SetVerifyCallBack(int nPort, unsigned int nBeginTime, unsigned int nEndTime, void (__stdcall* funVerify)(int nPort, FRAME_POS* pFilePos, unsigned int bIsVideo, unsigned int nUser), unsigned int nUser);
|
||||
int PlayM4_SetEncChangeMsg(int nPort, PLAYM4_HWND hWnd, unsigned int nMsg);
|
||||
int PlayM4_SetGetUserDataCallBack(int nPort, void(CALLBACK* funGetUserData)(int nPort, unsigned char* pUserBuf, unsigned int nBufLen, unsigned int nUser), unsigned int nUser);
|
||||
int PlayM4_GetOriginalFrameCallBack(int nPort, int bIsChange, int bNormalSpeed, int nStartFrameNum, int nStartStamp, int nFileHeader, void(CALLBACK *funGetOrignalFrame)(int nPort, FRAME_TYPE* frameType, int nUser), int nUser);
|
||||
int PlayM4_GetFileSpecialAttr(int nPort, unsigned int* pTimeStamp, unsigned int* pFileNum, unsigned int* pReserved);
|
||||
int PlayM4_GetThrowBFrameCallBack(int nPort, void(CALLBACK* funThrowBFrame)(int nPort, unsigned int nBFrame, unsigned int nUser), unsigned int nUser);
|
||||
int PlayM4_SetAudioCallBack(int nPort, void (__stdcall* funAudio)(int nPort, char* pAudioBuf, int nSize, int nStamp, int nType, int nUser), int nUser);
|
||||
//motionflow <20><>֡
|
||||
PLAYM4_API int __stdcall PlayM4_MotionFlow(int nPort, unsigned int dwAdjustType);
|
||||
|
||||
int PlayM4_SetTimerType(int nPort,unsigned int nTimerType,unsigned int nReserved);
|
||||
int PlayM4_GetTimerType(int nPort,unsigned int *pTimerType,unsigned int *pReserved);
|
||||
int PlayM4_SetDisplayMode(int nPort, unsigned int dwType);
|
||||
//<2F>ݲ<EFBFBD>ʵ<EFBFBD>ִ˺<D6B4><CBBA><EFBFBD>
|
||||
PLAYM4_API int __stdcall PlayM4_SetSycStartTime(int nPort, PLAYM4_SYSTEM_TIME *pstSystemTime);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_PLAYM4_H_
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef _PLAYM4_H_
|
||||
#define _PLAYM4_H_
|
||||
#if defined(__APPLE__)
|
||||
#include"ApplePlayM4.h"
|
||||
#elif defined(__linux__)
|
||||
#include"LinuxPlayM4.h"
|
||||
#elif defined(ANDROID)
|
||||
#include"LinuxPlayM4.h"
|
||||
#elif defined(WIN32)
|
||||
#include"WindowsPlayM4.h"
|
||||
#endif
|
||||
|
||||
|
||||
#endif //_PLAYM4_H_
|
||||
@@ -0,0 +1,392 @@
|
||||
#ifndef _WINDOWSPLAYM4_H_
|
||||
#define _WINDOWSPLAYM4_H_
|
||||
|
||||
#if defined( _WINDLL)
|
||||
#define PLAYM4_API extern "C"__declspec(dllexport)
|
||||
#else
|
||||
#define PLAYM4_API extern "C" __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
//Max channel numbers
|
||||
#define PLAYM4_MAX_SUPPORTS 500
|
||||
//Wave coef range;
|
||||
#define MIN_WAVE_COEF -100
|
||||
#define MAX_WAVE_COEF 100
|
||||
|
||||
//Timer type
|
||||
#define TIMER_1 1 //Only 16 timers for every process.Default TIMER;
|
||||
#define TIMER_2 2 //Not limit;But the precision less than TIMER_1;
|
||||
|
||||
//BUFFER TYPE
|
||||
#define BUF_VIDEO_SRC 1
|
||||
#define BUF_AUDIO_SRC 2
|
||||
#define BUF_VIDEO_RENDER 3
|
||||
#define BUF_AUDIO_RENDER 4
|
||||
|
||||
//Error code
|
||||
#define PLAYM4_NOERROR 0 //no error
|
||||
#define PLAYM4_PARA_OVER 1 //input parameter is invalid;
|
||||
#define PLAYM4_ORDER_ERROR 2 //The order of the function to be called is error.
|
||||
#define PLAYM4_TIMER_ERROR 3 //Create multimedia clock failed;
|
||||
#define PLAYM4_DEC_VIDEO_ERROR 4 //Decode video data failed.
|
||||
#define PLAYM4_DEC_AUDIO_ERROR 5 //Decode audio data failed.
|
||||
#define PLAYM4_ALLOC_MEMORY_ERROR 6 //Allocate memory failed.
|
||||
#define PLAYM4_OPEN_FILE_ERROR 7 //Open the file failed.
|
||||
#define PLAYM4_CREATE_OBJ_ERROR 8 //Create thread or event failed
|
||||
#define PLAYM4_CREATE_DDRAW_ERROR 9 //Create DirectDraw object failed.
|
||||
#define PLAYM4_CREATE_OFFSCREEN_ERROR 10 //failed when creating off-screen surface.
|
||||
#define PLAYM4_BUF_OVER 11 //buffer is overflow
|
||||
#define PLAYM4_CREATE_SOUND_ERROR 12 //failed when creating audio device.
|
||||
#define PLAYM4_SET_VOLUME_ERROR 13 //Set volume failed
|
||||
#define PLAYM4_SUPPORT_FILE_ONLY 14 //The function only support play file.
|
||||
#define PLAYM4_SUPPORT_STREAM_ONLY 15 //The function only support play stream.
|
||||
#define PLAYM4_SYS_NOT_SUPPORT 16 //System not support.
|
||||
#define PLAYM4_FILEHEADER_UNKNOWN 17 //No file header.
|
||||
#define PLAYM4_VERSION_INCORRECT 18 //The version of decoder and encoder is not adapted.
|
||||
#define PLAYM4_INIT_DECODER_ERROR 19 //Initialize decoder failed.
|
||||
#define PLAYM4_CHECK_FILE_ERROR 20 //The file data is unknown.
|
||||
#define PLAYM4_INIT_TIMER_ERROR 21 //Initialize multimedia clock failed.
|
||||
#define PLAYM4_BLT_ERROR 22 //Blt failed.
|
||||
#define PLAYM4_UPDATE_ERROR 23 //Update failed.
|
||||
#define PLAYM4_OPEN_FILE_ERROR_MULTI 24 //openfile error, streamtype is multi
|
||||
#define PLAYM4_OPEN_FILE_ERROR_VIDEO 25 //openfile error, streamtype is video
|
||||
#define PLAYM4_JPEG_COMPRESS_ERROR 26 //JPEG compress error
|
||||
#define PLAYM4_EXTRACT_NOT_SUPPORT 27 //Don't support the version of this file.
|
||||
#define PLAYM4_EXTRACT_DATA_ERROR 28 //extract video data failed.
|
||||
#define PLAYM4_SECRET_KEY_ERROR 29 //Secret key is error //add 20071218
|
||||
#define PLAYM4_DECODE_KEYFRAME_ERROR 30 //add by hy 20090318
|
||||
#define PLAYM4_NEED_MORE_DATA 31 //add by hy 20100617
|
||||
#define PLAYM4_INVALID_PORT 32 //add by cj 20100913
|
||||
#define PLAYM4_NOT_FIND 33 //add by cj 20110428
|
||||
#define PLAYM4_FAIL_UNKNOWN 99 //Fail, but the reason is unknown;
|
||||
|
||||
//Max display regions.
|
||||
#define MAX_DISPLAY_WND 4
|
||||
|
||||
//Display type
|
||||
#define DISPLAY_NORMAL 1
|
||||
#define DISPLAY_QUARTER 2
|
||||
#define DISPLAY_YC_SCALE 4 //add by gb 20091116
|
||||
|
||||
//Display buffers
|
||||
#define MAX_DIS_FRAMES 50
|
||||
#define MIN_DIS_FRAMES 1
|
||||
|
||||
//Locate by
|
||||
#define BY_FRAMENUM 1
|
||||
#define BY_FRAMETIME 2
|
||||
|
||||
//Source buffer
|
||||
#define SOURCE_BUF_MAX 1024*100000
|
||||
#define SOURCE_BUF_MIN 1024*50
|
||||
|
||||
//Stream type
|
||||
#define STREAME_REALTIME 0
|
||||
#define STREAME_FILE 1
|
||||
|
||||
//frame type
|
||||
#define T_AUDIO16 101
|
||||
#define T_AUDIO8 100
|
||||
#define T_UYVY 1
|
||||
#define T_YV12 3
|
||||
#define T_RGB32 7
|
||||
|
||||
//capability
|
||||
#define SUPPORT_DDRAW 1
|
||||
#define SUPPORT_BLT 2
|
||||
#define SUPPORT_BLTFOURCC 4
|
||||
#define SUPPORT_BLTSHRINKX 8
|
||||
#define SUPPORT_BLTSHRINKY 16
|
||||
#define SUPPORT_BLTSTRETCHX 32
|
||||
#define SUPPORT_BLTSTRETCHY 64
|
||||
#define SUPPORT_SSE 128
|
||||
#define SUPPORT_MMX 256
|
||||
|
||||
// <20><><EFBFBD>º궨<C2BA><EAB6A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>HIK_MEDIAINFO<46>ṹ
|
||||
#define FOURCC_HKMI 0x484B4D49 // "HKMI" HIK_MEDIAINFO<46>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD>
|
||||
// ϵͳ<CFB5><CDB3>װ<EFBFBD><D7B0>ʽ
|
||||
#define SYSTEM_NULL 0x0 // û<><C3BB>ϵͳ<CFB5>㣬<EFBFBD><E3A3AC><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>
|
||||
#define SYSTEM_HIK 0x1 // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
#define SYSTEM_MPEG2_PS 0x2 // PS<50><53>װ
|
||||
#define SYSTEM_MPEG2_TS 0x3 // TS<54><53>װ
|
||||
#define SYSTEM_RTP 0x4 // rtp<74><70>װ
|
||||
#define SYSTEM_RTPHIK 0x401 // rtp<74><70>װ
|
||||
|
||||
// <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define VIDEO_NULL 0x0 // û<><C3BB><EFBFBD><EFBFBD>Ƶ
|
||||
#define VIDEO_H264 0x1 // <20><><EFBFBD><EFBFBD>H.264
|
||||
#define VIDEO_MPEG4 0x3 // <20><>MPEG4
|
||||
#define VIDEO_MJPEG 0x4
|
||||
#define VIDEO_AVC264 0x0100
|
||||
|
||||
// <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define AUDIO_NULL 0x0000 // û<><C3BB><EFBFBD><EFBFBD>Ƶ
|
||||
#define AUDIO_ADPCM 0x1000 // ADPCM
|
||||
#define AUDIO_MPEG 0x2000 // MPEG ϵ<><CFB5><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD><D3A6><EFBFBD><EFBFBD>MPEG<45><47>Ƶ
|
||||
// Gϵ<47><CFB5><EFBFBD><EFBFBD>Ƶ
|
||||
#define AUDIO_RAW_DATA8 0x7000 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ8k<38><6B>ԭʼ<D4AD><CABC><EFBFBD><EFBFBD>
|
||||
#define AUDIO_RAW_UDATA16 0x7001 //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ16k<36><6B>ԭʼ<D4AD><CABC><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD>L16
|
||||
#define AUDIO_G711_U 0x7110
|
||||
#define AUDIO_G711_A 0x7111
|
||||
#define AUDIO_G722_1 0x7221
|
||||
#define AUDIO_G723_1 0x7231
|
||||
#define AUDIO_G726_U 0x7260
|
||||
#define AUDIO_G726_A 0x7261
|
||||
#define AUDIO_G729 0x7290
|
||||
#define AUDIO_AMR_NB 0x3000
|
||||
|
||||
#define SYNCDATA_VEH 1 //ͬ<><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
#define SYNCDATA_IVS 2 //ͬ<><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
|
||||
//motion flow type
|
||||
#define MOTION_FLOW_NONE 0
|
||||
#define MOTION_FLOW_INTERLACE 1
|
||||
#define MOTION_FLOW_CPU 2
|
||||
#define MOTION_FLOW_GPU 3
|
||||
|
||||
//Frame position
|
||||
typedef struct{
|
||||
long nFilePos;
|
||||
long nFrameNum;
|
||||
long nFrameTime;
|
||||
long nErrorFrameNum;
|
||||
SYSTEMTIME *pErrorTime;
|
||||
long nErrorLostFrameNum;
|
||||
long nErrorFrameSize;
|
||||
}FRAME_POS,*PFRAME_POS;
|
||||
|
||||
//Frame Info
|
||||
typedef struct{
|
||||
long nWidth;
|
||||
long nHeight;
|
||||
long nStamp;
|
||||
long nType;
|
||||
long nFrameRate;
|
||||
DWORD dwFrameNum;
|
||||
}FRAME_INFO;
|
||||
|
||||
//Frame
|
||||
typedef struct{
|
||||
char *pDataBuf;
|
||||
long nSize;
|
||||
long nFrameNum;
|
||||
BOOL bIsAudio;
|
||||
long nReserved;
|
||||
}FRAME_TYPE;
|
||||
|
||||
//Watermark Info //add by gb 080119
|
||||
typedef struct{
|
||||
char *pDataBuf;
|
||||
long nSize;
|
||||
long nFrameNum;
|
||||
BOOL bRsaRight;
|
||||
long nReserved;
|
||||
}WATERMARK_INFO;
|
||||
|
||||
typedef struct SYNCDATA_INFO
|
||||
{
|
||||
DWORD dwDataType; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ͣ<EFBFBD>Ŀǰ<C4BF>У<EFBFBD><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
DWORD dwDataLen; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
BYTE* pData; //ָ<><D6B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD>ݽṹ<DDBD><E1B9B9>ָ<EFBFBD><D6B8>,<2C><><EFBFBD><EFBFBD>IVS_INFO<46>ṹ
|
||||
} SYNCDATA_INFO;
|
||||
|
||||
#ifndef _HIK_MEDIAINFO_FLAG_
|
||||
#define _HIK_MEDIAINFO_FLAG_
|
||||
typedef struct _HIK_MEDIAINFO_ // modified by gb 080425
|
||||
{
|
||||
unsigned int media_fourcc; // "HKMI": 0x484B4D49 Hikvision Media Information
|
||||
unsigned short media_version; // <20>汾<EFBFBD>ţ<EFBFBD>ָ<EFBFBD><D6B8><EFBFBD><EFBFBD>Ϣ<EFBFBD>ṹ<EFBFBD>汾<EFBFBD>ţ<EFBFBD>ĿǰΪ0x0101,<2C><>1.01<EFBFBD>汾<EFBFBD><EFBFBD>01<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>汾<EFBFBD>ţ<EFBFBD>01<EFBFBD><EFBFBD><EFBFBD>Ӱ汾<EFBFBD>š<EFBFBD>
|
||||
unsigned short device_id; // <20>豸ID<49><44><EFBFBD><EFBFBD><EFBFBD>ڸ<EFBFBD><DAB8><EFBFBD>/<2F><><EFBFBD><EFBFBD>
|
||||
|
||||
unsigned short system_format; // ϵͳ<CFB5><CDB3>װ<EFBFBD><D7B0>
|
||||
unsigned short video_format; // <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
unsigned short audio_format; // <20><>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned char audio_channels; // ͨ<><CDA8><EFBFBD><EFBFBD>
|
||||
unsigned char audio_bits_per_sample; // <20><>λ<EFBFBD><CEBB>
|
||||
unsigned int audio_samplesrate; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
unsigned int audio_bitrate; // ѹ<><D1B9><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD>,<2C><>λ<EFBFBD><CEBB>bit
|
||||
|
||||
unsigned int reserved[4]; // <20><><EFBFBD><EFBFBD>
|
||||
}HIK_MEDIAINFO;
|
||||
#endif
|
||||
|
||||
typedef struct
|
||||
{
|
||||
long nPort;
|
||||
char * pBuf;
|
||||
long nBufLen;
|
||||
long nWidth;
|
||||
long nHeight;
|
||||
long nStamp;
|
||||
long nType;
|
||||
long nUser;
|
||||
}DISPLAY_INFO;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//API
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////ver 1.0///////////////////////////////////////
|
||||
//Initialize DirecDraw.Now invalid.
|
||||
PLAYM4_API BOOL __stdcall PlayM4_InitDDraw(HWND hWnd);
|
||||
//Release directDraw; Now invalid.
|
||||
PLAYM4_API BOOL __stdcall PlayM4_RealeseDDraw();
|
||||
|
||||
PLAYM4_API BOOL __stdcall PlayM4_OpenFile(LONG nPort,LPSTR sFileName);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_CloseFile(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_Play(LONG nPort, HWND hWnd);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_Stop(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_Pause(LONG nPort,DWORD nPause);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_Fast(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_Slow(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_OneByOne(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetPlayPos(LONG nPort,float fRelativePos);
|
||||
PLAYM4_API float __stdcall PlayM4_GetPlayPos(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetFileEndMsg(LONG nPort,HWND hWnd,UINT nMsg);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetVolume(LONG nPort,WORD nVolume);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_StopSound();
|
||||
PLAYM4_API BOOL __stdcall PlayM4_PlaySound(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_OpenStream(LONG nPort,PBYTE pFileHeadBuf,DWORD nSize,DWORD nBufPoolSize);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_InputData(LONG nPort,PBYTE pBuf,DWORD nSize);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_CloseStream(LONG nPort);
|
||||
PLAYM4_API int __stdcall PlayM4_GetCaps();
|
||||
PLAYM4_API DWORD __stdcall PlayM4_GetFileTime(LONG nPort);
|
||||
PLAYM4_API DWORD __stdcall PlayM4_GetPlayedTime(LONG nPort);
|
||||
PLAYM4_API DWORD __stdcall PlayM4_GetPlayedFrames(LONG nPort);
|
||||
|
||||
////////////////ver 2.0 added///////////////////////////////////////
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetDecCallBack(LONG nPort,void (CALLBACK* DecCBFun)(long nPort,char * pBuf,long nSize,FRAME_INFO * pFrameInfo, long nReserved1,long nReserved2));
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayCallBack(LONG nPort,void (CALLBACK* DisplayCBFun)(long nPort,char * pBuf,long nSize,long nWidth,long nHeight,long nStamp,long nType,long nReserved));
|
||||
|
||||
PLAYM4_API BOOL __stdcall PlayM4_ConvertToBmpFile(char * pBuf,long nSize,long nWidth,long nHeight,long nType,char *sFileName);
|
||||
|
||||
PLAYM4_API DWORD __stdcall PlayM4_GetFileTotalFrames(LONG nPort);
|
||||
PLAYM4_API DWORD __stdcall PlayM4_GetCurrentFrameRate(LONG nPort);
|
||||
PLAYM4_API DWORD __stdcall PlayM4_GetPlayedTimeEx(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetPlayedTimeEx(LONG nPort,DWORD nTime);
|
||||
PLAYM4_API DWORD __stdcall PlayM4_GetCurrentFrameNum(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetStreamOpenMode(LONG nPort,DWORD nMode);
|
||||
PLAYM4_API DWORD __stdcall PlayM4_GetFileHeadLength();
|
||||
PLAYM4_API DWORD __stdcall PlayM4_GetSdkVersion();
|
||||
|
||||
////////////////ver 2.2 added///////////////////////////////////////
|
||||
PLAYM4_API DWORD __stdcall PlayM4_GetLastError(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_RefreshPlay(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetOverlayMode(LONG nPort,BOOL bOverlay,COLORREF colorKey);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_GetPictureSize(LONG nPort,LONG *pWidth,LONG *pHeight);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetPicQuality(LONG nPort,BOOL bHighQuality);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_PlaySoundShare(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_StopSoundShare(LONG nPort);
|
||||
|
||||
////////////////ver 2.4 added///////////////////////////////////////
|
||||
PLAYM4_API LONG __stdcall PlayM4_GetStreamOpenMode(LONG nPort);
|
||||
PLAYM4_API LONG __stdcall PlayM4_GetOverlayMode(LONG nPort);
|
||||
PLAYM4_API COLORREF __stdcall PlayM4_GetColorKey(LONG nPort);
|
||||
PLAYM4_API WORD __stdcall PlayM4_GetVolume(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_GetPictureQuality(LONG nPort,BOOL *bHighQuality);
|
||||
PLAYM4_API DWORD __stdcall PlayM4_GetSourceBufferRemain(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_ResetSourceBuffer(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetSourceBufCallBack(LONG nPort,DWORD nThreShold,void (CALLBACK * SourceBufCallBack)(long nPort,DWORD nBufSize,DWORD dwUser,void*pResvered),DWORD dwUser,void *pReserved);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_ResetSourceBufFlag(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayBuf(LONG nPort,DWORD nNum);
|
||||
PLAYM4_API DWORD __stdcall PlayM4_GetDisplayBuf(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_OneByOneBack(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetFileRefCallBack(LONG nPort, void (__stdcall *pFileRefDone)(DWORD nPort,DWORD nUser),DWORD nUser);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetCurrentFrameNum(LONG nPort,DWORD nFrameNum);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_GetKeyFramePos(LONG nPort,DWORD nValue, DWORD nType, PFRAME_POS pFramePos);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_GetNextKeyFramePos(LONG nPort,DWORD nValue, DWORD nType, PFRAME_POS pFramePos);
|
||||
#if (WINVER >= 0x0400)
|
||||
//Note: These funtion must be builded under win2000 or above with Microsoft Platform sdk.
|
||||
// You can download the sdk from "http://www.microsoft.com/msdownload/platformsdk/sdkupdate/";
|
||||
PLAYM4_API BOOL __stdcall PlayM4_InitDDrawDevice();
|
||||
PLAYM4_API void __stdcall PlayM4_ReleaseDDrawDevice();
|
||||
PLAYM4_API DWORD __stdcall PlayM4_GetDDrawDeviceTotalNums();
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetDDrawDevice(LONG nPort,DWORD nDeviceNum);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_GetDDrawDeviceInfo(DWORD nDeviceNum,LPSTR lpDriverDescription,DWORD nDespLen,LPSTR lpDriverName ,DWORD nNameLen,HMONITOR *hhMonitor);
|
||||
PLAYM4_API int __stdcall PlayM4_GetCapsEx(DWORD nDDrawDeviceNum);
|
||||
#endif
|
||||
PLAYM4_API BOOL __stdcall PlayM4_ThrowBFrameNum(LONG nPort,DWORD nNum);
|
||||
|
||||
////////////////ver 2.5 added///////////////////////////////////////
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayType(LONG nPort,LONG nType);
|
||||
PLAYM4_API long __stdcall PlayM4_GetDisplayType(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SyncToAudio(LONG nPort, BOOL bSyncToAudio);
|
||||
|
||||
////////////////ver 3.0 added///////////////////////////////////////
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetDecCBStream(LONG nPort,DWORD nStream);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayRegion(LONG nPort,DWORD nRegionNum, RECT *pSrcRect, HWND hDestWnd, BOOL bEnable);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_RefreshPlayEx(LONG nPort,DWORD nRegionNum);
|
||||
#if (WINVER >= 0x0400)
|
||||
//Note: The funtion must be builded under win2000 or above with Microsoft Platform sdk.
|
||||
// You can download the sdk from http://www.microsoft.com/msdownload/platformsdk/sdkupdate/;
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetDDrawDeviceEx(LONG nPort,DWORD nRegionNum,DWORD nDeviceNum);
|
||||
#endif
|
||||
/////////////////v3.2 added/////////////////////////////////////////
|
||||
|
||||
PLAYM4_API BOOL __stdcall PlayM4_GetRefValue(LONG nPort,BYTE *pBuffer, DWORD *pSize);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetRefValue(LONG nPort,BYTE *pBuffer, DWORD nSize);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_OpenStreamEx(LONG nPort,PBYTE pFileHeadBuf,DWORD nSize,DWORD nBufPoolSize);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_CloseStreamEx(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_InputVideoData(LONG nPort,PBYTE pBuf,DWORD nSize);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_InputAudioData(LONG nPort,PBYTE pBuf,DWORD nSize);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_RegisterDrawFun(LONG nPort,void (CALLBACK* DrawFun)(long nPort,HDC hDc,LONG nUser),LONG nUser);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_RigisterDrawFun(LONG nPort,void (CALLBACK* DrawFun)(long nPort,HDC hDc,LONG nUser),LONG nUser);
|
||||
//////////////////v3.4/////////////////////////////////////////////////////
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetTimerType(LONG nPort,DWORD nTimerType,DWORD nReserved);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_GetTimerType(LONG nPort,DWORD *pTimerType,DWORD *pReserved);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_ResetBuffer(LONG nPort,DWORD nBufType);
|
||||
PLAYM4_API DWORD __stdcall PlayM4_GetBufferValue(LONG nPort,DWORD nBufType);
|
||||
//////////////////V3.6/////////////////////////////////////////////////////////
|
||||
PLAYM4_API BOOL __stdcall PlayM4_AdjustWaveAudio(LONG nPort,LONG nCoefficient);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetVerifyCallBack(LONG nPort, DWORD nBeginTime, DWORD nEndTime, void (__stdcall * funVerify)(long nPort, FRAME_POS * pFilePos, DWORD bIsVideo, DWORD nUser), DWORD nUser);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetAudioCallBack(LONG nPort, void (__stdcall * funAudio)(long nPort, char * pAudioBuf, long nSize, long nStamp, long nType, long nUser), long nUser);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetEncTypeChangeCallBack(LONG nPort,void(CALLBACK *funEncChange)(long nPort,long nUser),long nUser);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetColor(LONG nPort, DWORD nRegionNum, int nBrightness, int nContrast, int nSaturation, int nHue);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_GetColor(LONG nPort, DWORD nRegionNum, int *pBrightness, int *pContrast, int *pSaturation, int *pHue);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetEncChangeMsg(LONG nPort,HWND hWnd,UINT nMsg);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_GetOriginalFrameCallBack(LONG nPort, BOOL bIsChange,BOOL bNormalSpeed,long nStartFrameNum,long nStartStamp,long nFileHeader,void(CALLBACK *funGetOrignalFrame)(long nPort,FRAME_TYPE *frameType, long nUser),long nUser);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_GetFileSpecialAttr(LONG nPort, DWORD *pTimeStamp,DWORD *pFileNum ,DWORD *pReserved);
|
||||
PLAYM4_API DWORD __stdcall PlayM4_GetSpecialData(LONG nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetCheckWatermarkCallBack(LONG nPort,void(CALLBACK* funCheckWatermark)(long nPort,WATERMARK_INFO* pWatermarkInfo,DWORD nUser),DWORD nUser);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetImageSharpen(LONG nPort,DWORD nLevel);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_GetThrowBFrameCallBack(LONG nPort,void(CALLBACK* funThrowBFrame)(long nPort,DWORD nBFrame,DWORD nUser),DWORD nUser);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetDecodeFrameType(LONG nPort,DWORD nFrameType);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetPlayMode(LONG nPort,BOOL bNormal);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetGetUserDataCallBack(LONG nPort,void(CALLBACK* funGetUserData)(long nPort,BYTE *pUserBuf,DWORD nBufLen,DWORD nUser),DWORD nUser);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetOverlayFlipMode(LONG nPort,BOOL bTrue);
|
||||
PLAYM4_API DWORD __stdcall PlayM4_GetAbsFrameNum(LONG nPort);
|
||||
|
||||
//////////////////V4.7.0.0//////////////////////////////////////////////////////
|
||||
////convert yuv to jpeg
|
||||
PLAYM4_API BOOL __stdcall PlayM4_ConvertToJpegFile(char * pBuf,long nSize,long nWidth,long nHeight,long nType,char *sFileName);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetJpegQuality(long nQuality);
|
||||
//set deflash
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetDeflash(LONG nPort,BOOL bDefalsh);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetDecCallBackEx(LONG nPort,void (CALLBACK* DecCBFun)(long nPort,char * pBuf,long nSize,FRAME_INFO * pFrameInfo, long nReserved1,long nReserved2), char* pDest, long nDestSize);
|
||||
//////////////////V4.8.0.0/////////////////////////////////////////////////////////
|
||||
//check discontinuous frame number as error data?
|
||||
PLAYM4_API BOOL __stdcall PlayM4_CheckDiscontinuousFrameNum(LONG nPort, BOOL bCheck);
|
||||
//get bmp or jpeg
|
||||
PLAYM4_API BOOL __stdcall PlayM4_GetBMP(LONG nPort,PBYTE pBitmap,DWORD nBufSize,DWORD* pBmpSize);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_GetJPEG(LONG nPort,PBYTE pJpeg,DWORD nBufSize,DWORD* pJpegSize);
|
||||
//dec call back mend
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetDecCallBackMend(LONG nPort,void (CALLBACK* DecCBFun)(long nPort,char * pBuf,long nSize,FRAME_INFO * pFrameInfo, long nUser,long nReserved2), long nUser);
|
||||
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetSecretKey(LONG nPort, LONG lKeyType, char *pSecretKey, LONG lKeyLen);
|
||||
|
||||
// add by gb 2007-12-23
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetFileEndCallback(LONG nPort, void(CALLBACK*FileEndCallback)(long nPort, void *pUser), void *pUser);
|
||||
|
||||
// add by gb 080131 version 4.9.0.1
|
||||
PLAYM4_API BOOL __stdcall PlayM4_GetPort(LONG* nPort);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_FreePort(LONG nPort);
|
||||
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetDisplayCallBackEx(LONG nPort,void (CALLBACK* DisplayCBFun)(DISPLAY_INFO *pstDisplayInfo), long nUser);
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SkipErrorData(LONG nPort, BOOL bSkip);
|
||||
|
||||
PLAYM4_API BOOL __stdcall PlayM4_SetDecCallBackExMend(LONG nPort, void (CALLBACK* DecCBFun)(long nPort, char* pBuf, long nSize, FRAME_INFO* pFrameInfo,
|
||||
long nUser, long nReserved2), char* pDest, long nDestSize, long nUser);
|
||||
////////////////////////////vHide add by hlj from xuqian////////////////////////////////////////////////////////
|
||||
PLAYM4_API BOOL __stdcall PlayM4_GetFileTimeEx(LONG nPort, DWORD *pStart,DWORD *pStop,DWORD *pRev);
|
||||
#endif //_WINDOWSPLAYM4_H_
|
||||
@@ -0,0 +1,8 @@
|
||||
1.请使用qt4.7版本,将lib下所有so文件拷贝到QtDemo/Linux32/lib,使用qtcreator编译生成QtClientDemo,双击运行
|
||||
2.如果要在qtcreator调试运行,需要将lib/HCNetSDKCom文件夹拷贝到与Makefile同级目录下
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
/************************************************************************
|
||||
* Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
|
||||
* FileName : exitdemo.cpp
|
||||
* Description : exit dialogue
|
||||
* Modification History : none
|
||||
* Version : V1.0
|
||||
* Time : 2009-11,12
|
||||
* Author : wanggongpu
|
||||
* Descrp : responding implemnet in mainwindow
|
||||
*************************************************************************/
|
||||
#include "exitdemo.h"
|
||||
|
||||
/************************************************************************
|
||||
* Function : ExitDemo
|
||||
* Description : instructor
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
ExitDemo::ExitDemo(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : ~ExitDemo
|
||||
* Description : destructor
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
ExitDemo::~ExitDemo()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/************************************************************************
|
||||
* Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
|
||||
* FileName : exitdemo.h
|
||||
* Description : exit
|
||||
* Modification History : none
|
||||
* Version : V1.0
|
||||
* Time : 2009-11,12
|
||||
* Author : wanggongpu
|
||||
* Descrp :
|
||||
*************************************************************************/
|
||||
#ifndef EXITDEMO_H
|
||||
#define EXITDEMO_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
#include "ui_exitdemo.h"
|
||||
|
||||
class ExitDemo : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
friend class QtClientDemo;
|
||||
ExitDemo(QWidget *parent = 0);
|
||||
~ExitDemo();
|
||||
|
||||
private:
|
||||
Ui::ExitDemoClass ui;
|
||||
};
|
||||
|
||||
#endif // EXITDEMO_H
|
||||
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ExitDemoClass</class>
|
||||
<widget class="QDialog" name="ExitDemoClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>283</width>
|
||||
<height>87</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>ExitDemo</string>
|
||||
</property>
|
||||
<widget class="QPushButton" name="pushButton_sure">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>50</y>
|
||||
<width>77</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sure</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_cancel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>160</x>
|
||||
<y>50</y>
|
||||
<width>77</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
<y>10</y>
|
||||
<width>121</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Sure to exit ?</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,116 @@
|
||||
/** @file AddNode.cpp
|
||||
* @note HangZhou Hikvision System Technology Co., Ltd. All Right Reserved.
|
||||
* @brief Add device node to the tree
|
||||
*
|
||||
* @author wanggongpu
|
||||
* @modify by panyadong
|
||||
* @date 2012-5-22
|
||||
*
|
||||
* @note:
|
||||
*/
|
||||
#include <QMessageBox>
|
||||
#include <stdio.h>
|
||||
#include "addnode.h"
|
||||
#include "DemoPublic.h"
|
||||
|
||||
class DeviceData;
|
||||
|
||||
/** @fn AddNode::AddNode(QWidget *parent): QDialog(parent)
|
||||
* @brief
|
||||
* @param (IN) parent
|
||||
* @return none.
|
||||
*/
|
||||
AddNode::AddNode(QWidget *parent): QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
connect(ui.m_pCheckBoxIPserver, SIGNAL(clicked()), this, SLOT(CheckUserIPServer()));
|
||||
|
||||
m_iuserid = -1;
|
||||
memset(&m_deviceinfo, 0, sizeof(NET_DVR_DEVICEINFO_V30));
|
||||
memset(&m_ipparacfg, 0, sizeof(NET_DVR_IPPARACFG));
|
||||
|
||||
ui.passwd_lineEdit->setText(QString("hik12345"));
|
||||
ui.usrname_lineEdit->setText(QString("admin"));
|
||||
ui.port_lineEdit->setText(QString("8000"));
|
||||
|
||||
ui.m_pEditIPServerIP->setText(QString("172.9.6.91"));
|
||||
ui.m_pEditIPServerPort->setText(QString("7071"));
|
||||
|
||||
ui.m_pCheckBoxIPserver->setChecked(TRUE);
|
||||
}
|
||||
|
||||
/** @fn AddNode::~AddNode()
|
||||
* @brief
|
||||
* @param none
|
||||
*/
|
||||
AddNode::~AddNode()
|
||||
{
|
||||
}
|
||||
|
||||
/** @fn void AddNode::on_cancel_pushButton_clicked()
|
||||
* @brief
|
||||
* @param none
|
||||
* @return none
|
||||
*/
|
||||
void AddNode::on_cancel_pushButton_clicked()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
/** @fn void AddNode::on_m_pBtnGetDeviceIP_clicked()
|
||||
* @brief
|
||||
* @param none
|
||||
* @return none
|
||||
*/
|
||||
void AddNode::on_m_pBtnGetDeviceIP_clicked()
|
||||
{
|
||||
//in
|
||||
char strIPServerIP[DEMO_IP_MAX_LEN] = {0};
|
||||
WORD wIPServerPort = 7071;
|
||||
char strDeviceName[NAME_LEN + 1] = {0};
|
||||
char strSearialNumber[SERIALNO_LEN + 1] = {0};
|
||||
//out
|
||||
char strDeviceIP[DEMO_IP_MAX_LEN] = {0};
|
||||
DWORD dwDevicePort = 8000;
|
||||
|
||||
//Get information
|
||||
strcpy(strIPServerIP, ui.m_pEditIPServerIP->text().toLocal8Bit().data());
|
||||
wIPServerPort = ui.m_pEditIPServerPort->text().toShort();
|
||||
strcpy(strDeviceName, ui.m_pEditDeviceName->text().toLocal8Bit().data());
|
||||
strcpy(strSearialNumber, ui.m_pEditDeviceSerial->text().toLocal8Bit().data());
|
||||
|
||||
if (NET_DVR_GetDVRIPByResolveSvr_EX(strIPServerIP, wIPServerPort, (BYTE *)strDeviceName, strlen(strDeviceName), \
|
||||
(BYTE *)strSearialNumber, strlen(strSearialNumber), strDeviceIP, &dwDevicePort))
|
||||
{
|
||||
//Set device ip and port
|
||||
ui.ip_lineEdit->setText(strDeviceIP);
|
||||
char strPort[10] = {0};
|
||||
sprintf(strPort, "%d", dwDevicePort);
|
||||
ui.port_lineEdit->setText(strPort);
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::information(this, tr("NET_DVR_GetDVRIPByResolveSvr_EX error"), tr("SDK_LASTERROR=%1").arg(NET_DVR_GetLastError()));
|
||||
}
|
||||
}
|
||||
|
||||
/** @fn void AddNode::CheckUserIPServer()
|
||||
* @brief
|
||||
* @param none
|
||||
* @return none
|
||||
*/
|
||||
void AddNode::CheckUserIPServer()
|
||||
{
|
||||
if (ui.m_pCheckBoxIPserver->isChecked())
|
||||
{
|
||||
ui.m_pFrameIPServer->setDisabled(FALSE);
|
||||
ui.m_pBtnGetDeviceIP->setDisabled(FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui.m_pFrameIPServer->setDisabled(TRUE);
|
||||
ui.m_pBtnGetDeviceIP->setDisabled(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/** @file addnode.h
|
||||
* @note HangZhou Hikvision System Technology Co., Ltd. All Right Reserved.
|
||||
* @brief
|
||||
*
|
||||
* @author wanggongpu
|
||||
* @modify by panyadong
|
||||
* @date 2012-5-22
|
||||
*
|
||||
* @note:
|
||||
*/
|
||||
#ifndef ADDNODE_H
|
||||
#define ADDNODE_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
#include "ui_addnode.h"
|
||||
|
||||
#include "DemoPublic.h"
|
||||
#include "devicedata.h"
|
||||
|
||||
class AddNode : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
friend class QtClientDemo;
|
||||
|
||||
AddNode(QWidget *parent = 0);
|
||||
~AddNode();
|
||||
|
||||
private slots:
|
||||
void on_cancel_pushButton_clicked();
|
||||
void on_m_pBtnGetDeviceIP_clicked();
|
||||
void CheckUserIPServer();
|
||||
|
||||
private:
|
||||
Ui::AddNodeClass ui;
|
||||
int m_iuserid;
|
||||
NET_DVR_DEVICEINFO_V30 m_deviceinfo;
|
||||
NET_DVR_IPPARACFG m_ipparacfg;
|
||||
};
|
||||
|
||||
#endif // ADDNODE_H
|
||||
|
||||
@@ -0,0 +1,250 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AddNodeClass</class>
|
||||
<widget class="QDialog" name="AddNodeClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>560</width>
|
||||
<height>341</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>AddNode</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<widget class="QPushButton" name="sure_pushButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>290</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Ok</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="cancel_pushButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>430</x>
|
||||
<y>290</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>120</y>
|
||||
<width>521</width>
|
||||
<height>161</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string/>
|
||||
</property>
|
||||
<widget class="QFrame" name="m_pFrameIPServer">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>45</y>
|
||||
<width>504</width>
|
||||
<height>101</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>38</y>
|
||||
<width>371</width>
|
||||
<height>62</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_4">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="devcname_label">
|
||||
<property name="text">
|
||||
<string>Device name </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="m_pEditDeviceName">
|
||||
<property name="maxLength">
|
||||
<number>32</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="devicemac_label">
|
||||
<property name="text">
|
||||
<string>Device serial number</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="m_pEditDeviceSerial">
|
||||
<property name="maxLength">
|
||||
<number>48</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>484</width>
|
||||
<height>29</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="getipaddrs_label">
|
||||
<property name="text">
|
||||
<string>IP Server address: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="m_pEditIPServerIP"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="getipaddrport_label">
|
||||
<property name="text">
|
||||
<string>IP Server port</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="m_pEditIPServerPort"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>491</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="m_pCheckBoxIPserver">
|
||||
<property name="text">
|
||||
<string>Get device ip from ip server</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="m_pBtnGetDeviceIP">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Get ip address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="layoutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>501</width>
|
||||
<height>101</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="nodename_label">
|
||||
<property name="text">
|
||||
<string>Node name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="nodename_lineEdit"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<widget class="QLabel" name="usrname_label">
|
||||
<property name="text">
|
||||
<string>Password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QLineEdit" name="passwd_lineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="ip_label">
|
||||
<property name="text">
|
||||
<string>Device ip</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="ip_lineEdit"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="passwd_label">
|
||||
<property name="text">
|
||||
<string>Username</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<widget class="QLineEdit" name="usrname_lineEdit"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="port_label">
|
||||
<property name="text">
|
||||
<string>Port</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="port_lineEdit"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,39 @@
|
||||
/***************************************************************************************
|
||||
* Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
|
||||
* FileName : channelattr.cpp
|
||||
* Description : ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD>ļ<EFBFBD>
|
||||
* Modification : <20><>
|
||||
* Version : V1.0.0
|
||||
* Time : 2009-10,11
|
||||
* Author : wanggp@hikvision.com
|
||||
**************************************************************************************/
|
||||
#include "channelattr.h"
|
||||
|
||||
/************************************************************************
|
||||
* Function : ChannelAttr
|
||||
* Description : <20><><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
* Input : parent
|
||||
* Output : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
ChannelAttr::ChannelAttr(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
ui.channNum_lineEdit->setDisabled(1);
|
||||
ui.devAddr_lineEdit->setDisabled(1);
|
||||
ui.devName_lineEdit->setDisabled(1);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : ~ChannelAttr
|
||||
* Description : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : <20><>
|
||||
* Output : <20>رս<D8B1><D5BD><EFBFBD>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
ChannelAttr::~ChannelAttr()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/***************************************************************************************
|
||||
* Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
|
||||
* FileName : channelattr.h
|
||||
* Description : ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
|
||||
* Modification : <20><>
|
||||
* Version : V1.0.0
|
||||
* Time : 2009-10,11
|
||||
* Author : wanggp@hikvision.com
|
||||
**************************************************************************************/
|
||||
#ifndef CHANNELATTR_H
|
||||
#define CHANNELATTR_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
#include "ui_channelattr.h"
|
||||
|
||||
class ChannelAttr : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
friend class QtClientDemo;
|
||||
ChannelAttr(QWidget *parent = 0);
|
||||
~ChannelAttr();
|
||||
|
||||
private:
|
||||
Ui::ChannelAttrClass ui;
|
||||
};
|
||||
|
||||
#endif // CHANNELATTR_H
|
||||
|
||||
@@ -0,0 +1,271 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ChannelAttrClass</class>
|
||||
<widget class="QDialog" name="ChannelAttrClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>312</width>
|
||||
<height>256</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>ChannelAttr</string>
|
||||
</property>
|
||||
<widget class="QLineEdit" name="channNum_lineEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>60</y>
|
||||
<width>113</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>290</x>
|
||||
<y>10</y>
|
||||
<width>20</width>
|
||||
<height>201</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="devAddr_label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>120</y>
|
||||
<width>61</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>设备地址</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>150</y>
|
||||
<width>61</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>传输协议</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="devName_label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>90</y>
|
||||
<width>61</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>设备名称</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="transProtocol_comboBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>150</y>
|
||||
<width>111</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>TCP</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>UDP</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Mcast</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RTP</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>RTP/RTSP</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="devAddr_lineEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>120</y>
|
||||
<width>113</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>10</y>
|
||||
<width>20</width>
|
||||
<height>201</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>180</y>
|
||||
<width>61</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>传输类型</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>200</y>
|
||||
<width>291</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="devName_lineEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>90</y>
|
||||
<width>113</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="sure_pushButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>220</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>确认</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" name="streamType_comboBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>180</y>
|
||||
<width>111</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>主码流</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>子码流</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="Line" name="line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>0</y>
|
||||
<width>291</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="cancel_pushButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>200</x>
|
||||
<y>220</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="channName_lineEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>120</x>
|
||||
<y>30</y>
|
||||
<width>113</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="channNodeName_label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>53</x>
|
||||
<y>30</y>
|
||||
<width>61</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道名称</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="channNum_label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>53</x>
|
||||
<y>60</y>
|
||||
<width>61</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>通道号</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,40 @@
|
||||
/***************************************************************************************
|
||||
* Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
|
||||
* FileName : deviceattr.cpp
|
||||
* Description : <20>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>Դ<EFBFBD>ļ<EFBFBD>
|
||||
* Modification : <20><>
|
||||
* Version : V1.0.0
|
||||
* Time : 2009-10,11
|
||||
* Author : wanggp@hikvision.com
|
||||
**************************************************************************************/
|
||||
#include "deviceattr.h"
|
||||
|
||||
/************************************************************************
|
||||
* Function : DeviceAttr
|
||||
* Description : <20>豸<EFBFBD><E8B1B8><EFBFBD>Խ<EFBFBD><D4BD><EFBFBD>
|
||||
* Input : parent
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
DeviceAttr::DeviceAttr(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
ui.SID_lineEdit->setDisabled(1);
|
||||
ui.devType_lineEdit->setDisabled(1);
|
||||
ui.McastIP_lineEdit->setDisabled(1);
|
||||
ui.channelNum_lineEdit->setDisabled(1);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : ~DeviceAttr
|
||||
* Description : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
DeviceAttr::~DeviceAttr()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/***************************************************************************************
|
||||
* Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
|
||||
* FileName : deviceattr.h
|
||||
* Description : <20>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
|
||||
* Modification : <20><>
|
||||
* Version : V1.0.0
|
||||
* Time : 2009-10,11
|
||||
* Author : wanggp@hikvision.com
|
||||
**************************************************************************************/
|
||||
#ifndef DEVICEATTR_H
|
||||
#define DEVICEATTR_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
#include "ui_deviceattr.h"
|
||||
|
||||
class DeviceAttr : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
friend class QtClientDemo;
|
||||
DeviceAttr(QWidget *parent = 0);
|
||||
~DeviceAttr();
|
||||
|
||||
private:
|
||||
Ui::DeviceAttrClass ui;
|
||||
};
|
||||
|
||||
#endif // DEVICEATTR_H
|
||||
|
||||
@@ -0,0 +1,305 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DeviceAttrClass</class>
|
||||
<widget class="QDialog" name="DeviceAttrClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>455</width>
|
||||
<height>216</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>DeviceAttr</string>
|
||||
</property>
|
||||
<widget class="QLineEdit" name="usrname_lineEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>290</x>
|
||||
<y>20</y>
|
||||
<width>131</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="sure_pushButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>210</x>
|
||||
<y>190</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ok</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>140</y>
|
||||
<width>61</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>serial No.</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="SID_lineEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>80</x>
|
||||
<y>140</y>
|
||||
<width>341</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="nodename_lineEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>20</y>
|
||||
<width>121</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>213</x>
|
||||
<y>110</y>
|
||||
<width>71</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>device type</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="devType_lineEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>290</x>
|
||||
<y>110</y>
|
||||
<width>131</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>110</y>
|
||||
<width>71</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>channel num</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="McastIP_lineEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>290</x>
|
||||
<y>80</y>
|
||||
<width>131</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="ip_lineEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>50</y>
|
||||
<width>121</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>50</y>
|
||||
<width>61</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>IP address</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>170</y>
|
||||
<width>421</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="cancel_pushButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>350</x>
|
||||
<y>190</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>cannel</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>420</x>
|
||||
<y>10</y>
|
||||
<width>21</width>
|
||||
<height>171</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="port_lineEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>80</y>
|
||||
<width>121</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>30</y>
|
||||
<width>54</width>
|
||||
<height>13</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>username</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>50</y>
|
||||
<width>51</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>password</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>10</y>
|
||||
<width>20</width>
|
||||
<height>171</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>80</y>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>port</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>30</y>
|
||||
<width>71</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>device name</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="channelNum_lineEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>110</y>
|
||||
<width>121</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>80</y>
|
||||
<width>61</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>multicast</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>0</y>
|
||||
<width>421</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="passwd_lineEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>290</x>
|
||||
<y>50</y>
|
||||
<width>131</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,267 @@
|
||||
/***************************************************************************************
|
||||
* Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
|
||||
* FileName : channeldata.cpp
|
||||
* Description : ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>
|
||||
* Modification : none
|
||||
* Version : V1.0.0
|
||||
* Time : 2009-10,11
|
||||
* Author : wanggp@hikvision.com
|
||||
*****************************************************************************************/
|
||||
#include "channeldata.h"
|
||||
|
||||
/************************************************************************
|
||||
* Function : ChannelData
|
||||
* Description : <20><><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
ChannelData::ChannelData()
|
||||
{
|
||||
m_qchannelname = "";
|
||||
m_ichannelnum = -1;
|
||||
m_irealhandle = -1;
|
||||
m_eprotocoltype = TCP;
|
||||
m_estreamtype = MAINSTREAM;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : ~ChannelData
|
||||
* Description : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
ChannelData::~ChannelData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : setChannelName
|
||||
* Description : <20><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : name
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
void ChannelData::setChannelName(QString name)
|
||||
{
|
||||
m_qchannelname = name;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : getChannelName
|
||||
* Description : <20><>ȡͨ<C8A1><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*************************************************************************/
|
||||
QString ChannelData::getChannelName()
|
||||
{
|
||||
return m_qchannelname;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : setChannelNum
|
||||
* Description : <20><><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>
|
||||
* Input : num
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
void ChannelData::setChannelNum(int num)
|
||||
{
|
||||
m_ichannelnum = num;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : getChannelNum
|
||||
* Description : <20><>ȡͨ<C8A1><CDA8><EFBFBD><EFBFBD>
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : m_iChannelNum
|
||||
*************************************************************************/
|
||||
int ChannelData::getChannelNum()
|
||||
{
|
||||
return m_ichannelnum;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : setProtocolType
|
||||
* Description : <20><><EFBFBD><EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : type
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
void ChannelData::setProtocolType(PROTOCOL type)
|
||||
{
|
||||
m_eprotocoltype = type;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : getProtocolType
|
||||
* Description : <20><>ȡЭ<C8A1><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*************************************************************************/
|
||||
PROTOCOL ChannelData::getProtocolType()
|
||||
{
|
||||
return m_eprotocoltype;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : getProtocolTypeQstring
|
||||
* Description : <20><>ȡЭ<C8A1><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : <20>ַ<EFBFBD><D6B7><EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*************************************************************************/
|
||||
QString ChannelData::getProtocolTypeQstring()
|
||||
{
|
||||
QString protocol;
|
||||
switch (m_eprotocoltype)
|
||||
{
|
||||
case TCP:
|
||||
protocol="TCP";
|
||||
break;
|
||||
case UDP:
|
||||
protocol="UDP";
|
||||
break;
|
||||
case MCAST :
|
||||
protocol="MCAST";
|
||||
break;
|
||||
case RTP:
|
||||
protocol="RTP";
|
||||
break;
|
||||
case RTP_RTSP:
|
||||
protocol = "RTP/RTSP";
|
||||
default :
|
||||
protocol = "error";
|
||||
break;
|
||||
}
|
||||
return protocol;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : setStreamType
|
||||
* Description : <20><><EFBFBD><EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
void ChannelData::setStreamType(STREAMTYPE type)
|
||||
{
|
||||
m_estreamtype = type;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : getStreamType
|
||||
* Description : <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*************************************************************************/
|
||||
STREAMTYPE ChannelData::getStreamType()
|
||||
{
|
||||
return m_estreamtype;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : getStreamTypeQstring
|
||||
* Description : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : <20>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*************************************************************************/
|
||||
QString ChannelData::getStreamTypeQstring()
|
||||
{
|
||||
QString type;
|
||||
|
||||
switch (m_estreamtype)
|
||||
{
|
||||
case MAINSTREAM:
|
||||
type="MAINSTREAM";
|
||||
break;
|
||||
case SUBSTREAM:
|
||||
type="SUBSTREAM";
|
||||
break;
|
||||
default :
|
||||
type = "error";
|
||||
break;
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
|
||||
void ChannelData::setLinkMode()
|
||||
{
|
||||
switch (m_estreamtype)
|
||||
{
|
||||
case MAINSTREAM:
|
||||
switch (m_eprotocoltype)
|
||||
{
|
||||
case TCP:
|
||||
m_ilinkmode =0x0;
|
||||
break;
|
||||
case UDP:
|
||||
m_ilinkmode=0x1;
|
||||
break;
|
||||
case MCAST :
|
||||
m_ilinkmode=0x2;
|
||||
break;
|
||||
case RTP:
|
||||
m_ilinkmode=0x3;
|
||||
break;
|
||||
case RTP_RTSP:
|
||||
m_ilinkmode=0x4;
|
||||
break;
|
||||
default :
|
||||
m_ilinkmode=0x0;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SUBSTREAM:
|
||||
switch (m_eprotocoltype)
|
||||
{
|
||||
case TCP:
|
||||
m_ilinkmode =0x80000000;
|
||||
break;
|
||||
case UDP:
|
||||
m_ilinkmode=0x80000001;
|
||||
break;
|
||||
case MCAST :
|
||||
m_ilinkmode=0x80000002;
|
||||
break;
|
||||
case RTP:
|
||||
m_ilinkmode=0x80000003;
|
||||
break;
|
||||
case RTP_RTSP:
|
||||
m_ilinkmode=0x80000004;
|
||||
break;
|
||||
default :
|
||||
m_ilinkmode=0x80000000;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int ChannelData::getLinkMode()
|
||||
{
|
||||
setLinkMode();
|
||||
return m_ilinkmode;
|
||||
}
|
||||
|
||||
|
||||
void ChannelData::setRealhandle(int num)
|
||||
{
|
||||
m_irealhandle = num;
|
||||
}
|
||||
|
||||
int ChannelData::getRealhandle()
|
||||
{
|
||||
return m_irealhandle;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
/***************************************************************************************
|
||||
* Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
|
||||
* FileName : channeldata.h
|
||||
* Description : ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
* Modification : <20>洢ͨ<E6B4A2><CDA8><EFBFBD><EFBFBD><EFBFBD>ص<EFBFBD><D8B5><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ڴ<EFBFBD>ȡ<EFBFBD>ļ<EFBFBD><C4BC>ͽ<EFBFBD><CDBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ʵʱ<CAB5><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>Ϣ
|
||||
* Version : V1.0.0
|
||||
* Time : 2009-10,11
|
||||
* Author : panyd@hikvision.com wanggp@hikvision.com
|
||||
*****************************************************************************************/
|
||||
#ifndef CHANNELDATA_H_
|
||||
#define CHANNELDATA_H_
|
||||
|
||||
|
||||
#include <QString>
|
||||
#include "devicedata.h"
|
||||
|
||||
enum PROTOCOL{ TCP = 0, UDP, MCAST, RTP, RTP_RTSP};
|
||||
enum STREAMTYPE{ MAINSTREAM = 0, SUBSTREAM};
|
||||
|
||||
|
||||
class ChannelData
|
||||
{
|
||||
|
||||
public:
|
||||
friend class DeviceData;
|
||||
friend class QtClientDemo;
|
||||
friend class RealPlay;
|
||||
friend class PlayBack;
|
||||
ChannelData();
|
||||
~ChannelData();
|
||||
|
||||
void setChannelName(QString name);
|
||||
QString getChannelName();
|
||||
|
||||
void setChannelNum(int num);
|
||||
int getChannelNum();
|
||||
|
||||
void setProtocolType(PROTOCOL type);
|
||||
PROTOCOL getProtocolType();
|
||||
QString getProtocolTypeQstring();
|
||||
|
||||
void setStreamType(STREAMTYPE type);
|
||||
STREAMTYPE getStreamType();
|
||||
QString getStreamTypeQstring();
|
||||
|
||||
void setLinkMode();
|
||||
int getLinkMode();
|
||||
|
||||
void setRealhandle(int num);
|
||||
int getRealhandle();
|
||||
|
||||
|
||||
private:
|
||||
//ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
QString m_qchannelname;
|
||||
//ͨ<><CDA8><EFBFBD><EFBFBD>
|
||||
int m_ichannelnum;
|
||||
//<2F><><EFBFBD><EFBFBD>Э<EFBFBD>飬<EFBFBD><E9A3AC>TCP,UDP<44><50><EFBFBD>ಥ<EFBFBD><E0B2A5><EFBFBD><EFBFBD>RTP<54><50>
|
||||
PROTOCOL m_eprotocoltype;
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
STREAMTYPE m_estreamtype;
|
||||
int m_ilinkmode;
|
||||
int m_irealhandle;
|
||||
};
|
||||
#endif /* CHANNELDATA_H_ */
|
||||
|
||||
@@ -0,0 +1,270 @@
|
||||
/***************************************************************************************
|
||||
* Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
|
||||
* FileName : devicedata.cpp
|
||||
* Description : <20>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><D8B2><EFBFBD>
|
||||
* Modification :
|
||||
* Version : V1.0.0
|
||||
* Time : 2009-10,11
|
||||
* Author : wanggp@hikvision.com
|
||||
****************************************************************************************/
|
||||
#include "devicedata.h"
|
||||
|
||||
/************************************************************************
|
||||
* Function : DeviceData
|
||||
* Description : <20><><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
DeviceData::DeviceData()
|
||||
{
|
||||
m_irealplaying =0;
|
||||
m_iuserid = -1;
|
||||
memset(&m_deviceinfo,0,sizeof(NET_DVR_DEVICEINFO_V30));
|
||||
m_qdevicename = "";
|
||||
m_qip = "";
|
||||
m_qiport = 0;
|
||||
m_qusername = "";
|
||||
m_qpassword = "";
|
||||
m_ideployed = -1;
|
||||
m_multiCast = "234.5.6.7";
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : ~DeviceData
|
||||
* Description : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
DeviceData::~DeviceData()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : setRealPlayLabel
|
||||
* Description : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : value
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
void DeviceData::setRealPlayLabel(int value)
|
||||
{
|
||||
m_irealplaying =value;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : getRealPlayLabel
|
||||
* Description : <20><>ȡ<EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>λֵ
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : m_irealplaying
|
||||
*************************************************************************/
|
||||
int DeviceData::getRealPlayLabel()
|
||||
{
|
||||
return m_irealplaying;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : setUsrID
|
||||
* Description : <20><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD>ID
|
||||
* Input : id
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
void DeviceData::setUsrID(int id)
|
||||
{
|
||||
m_iuserid = id;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : getUsrID
|
||||
* Description : <20><>ȡ<EFBFBD>û<EFBFBD>ID
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
int DeviceData::getUsrID()
|
||||
{
|
||||
return m_iuserid;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : setDeviceName
|
||||
* Description : <20><><EFBFBD><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||
* Input : devicename
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
void DeviceData::setDeviceName(QString devicename)
|
||||
{
|
||||
m_qdevicename = devicename;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : getDeviceName
|
||||
* Description : <20><>ȡ<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD>
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : m_qdevicename
|
||||
*************************************************************************/
|
||||
QString DeviceData::getDeviceName()
|
||||
{
|
||||
return m_qdevicename;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : setIP
|
||||
* Description : <20><><EFBFBD><EFBFBD>IP
|
||||
* Input : ip
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
void DeviceData::setIP(QString ip)
|
||||
{
|
||||
m_qip = ip;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : getIP
|
||||
* Description : <20><>ȡIP
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : m_qip
|
||||
*************************************************************************/
|
||||
QString DeviceData::getIP()
|
||||
{
|
||||
return m_qip;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : setPort
|
||||
* Description : <20><><EFBFBD>ö˿<C3B6>ֵ
|
||||
* Input : port
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
void DeviceData::setPort(int port)
|
||||
{
|
||||
m_qiport = port;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : getPort
|
||||
* Description : <20><>ȡ<EFBFBD>˿<EFBFBD>ֵ
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : m_qiport
|
||||
*************************************************************************/
|
||||
int DeviceData::getPort()
|
||||
{
|
||||
return m_qiport;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : setUsrName
|
||||
* Description : <20><><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>
|
||||
* Input : usrname
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
void DeviceData::setUsrName(QString usrname)
|
||||
{
|
||||
m_qusername = usrname;
|
||||
}
|
||||
|
||||
QString DeviceData::getUsrName()
|
||||
{
|
||||
return m_qusername;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : setPasswd
|
||||
* Description : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : passwd
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
void DeviceData::setPasswd(QString passwd)
|
||||
{
|
||||
m_qpassword = passwd;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : getPasswd
|
||||
* Description : <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : <20>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*************************************************************************/
|
||||
QString DeviceData::getPasswd()
|
||||
{
|
||||
return m_qpassword;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : modifyChannelDataChild
|
||||
* Description : <20><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : channel
|
||||
* Output : <20><>
|
||||
* Return : 0<>ɹ<EFBFBD>-1ʧ<31><CAA7>
|
||||
*************************************************************************/
|
||||
int DeviceData::modifyChannelDataChild(ChannelData *channel)
|
||||
{
|
||||
for ( QList<ChannelData >::Iterator it = m_qlistchanneldata.begin(); it !=
|
||||
m_qlistchanneldata.end(); ++it )
|
||||
{
|
||||
if ((*it).m_ichannelnum == channel->m_ichannelnum)
|
||||
{
|
||||
(*it).m_qchannelname = channel->m_qchannelname;
|
||||
(*it).m_eprotocoltype = channel->m_eprotocoltype;
|
||||
(*it).m_estreamtype = channel->m_estreamtype;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
NET_DVR_DEVICEINFO_V30 DeviceData::getDeviceInfo()
|
||||
{
|
||||
|
||||
return m_deviceinfo;
|
||||
}
|
||||
|
||||
void DeviceData::setDeployState(int deployed)
|
||||
{
|
||||
m_ideployed = deployed;
|
||||
}
|
||||
|
||||
int DeviceData::getDeployState()
|
||||
{
|
||||
return m_ideployed;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : setMultiCast
|
||||
* Description : <20><><EFBFBD>öಥ<C3B6><E0B2A5>ַ
|
||||
* Input : passwd
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
void DeviceData::setMultiCast(QString multiCast)
|
||||
{
|
||||
m_multiCast = multiCast;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : getMultiCast
|
||||
* Description : <20><>ȡ<EFBFBD>ಥ<EFBFBD><E0B2A5>ַ
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : <20>ಥ<EFBFBD><E0B2A5>ַ
|
||||
*************************************************************************/
|
||||
QString DeviceData::getMultiCast()
|
||||
{
|
||||
return m_multiCast;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/***************************************************************************************
|
||||
* Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
|
||||
* FileName : devicedata.h
|
||||
* Description : <20>豸<EFBFBD><E8B1B8>Ϣ
|
||||
* Modification : <20>洢<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD>ص<EFBFBD><D8B5><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD>ڴ<EFBFBD>ȡ<EFBFBD>ļ<EFBFBD><C4BC>ͽ<EFBFBD><CDBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE>ʵʱ<CAB5><EFBFBD><DEB8><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Version : V1.0.0
|
||||
* Time : 2009-10,11
|
||||
* Author : panyd@hikvision.com wanggp@hikvision.com
|
||||
*****************************************************************************************/
|
||||
|
||||
#ifndef DEVICEDATA_H_
|
||||
#define DEVICEDATA_H_
|
||||
|
||||
#include <QString>
|
||||
#include <QList>
|
||||
|
||||
#include "channeldata.h"
|
||||
#include "DemoPublic.h"
|
||||
|
||||
class ChannelData;
|
||||
|
||||
class DeviceData
|
||||
{
|
||||
public:
|
||||
friend class AddNode;
|
||||
friend class QtClientDemo;
|
||||
friend class RealPlay;
|
||||
friend class PlayBack;
|
||||
friend class SerialTransfer;
|
||||
DeviceData();
|
||||
~DeviceData();
|
||||
|
||||
void setRealPlayLabel(int value);
|
||||
int getRealPlayLabel();
|
||||
|
||||
void setUsrID(int id);
|
||||
int getUsrID();
|
||||
|
||||
void setDeviceName(QString devicename);
|
||||
QString getDeviceName();
|
||||
|
||||
void setIP(QString ip);
|
||||
QString getIP();
|
||||
|
||||
void setPort(int port);
|
||||
int getPort();
|
||||
|
||||
void setUsrName(QString usrname);
|
||||
QString getUsrName();
|
||||
|
||||
void setPasswd(QString passwd);
|
||||
QString getPasswd();
|
||||
|
||||
void setMultiCast(QString multiCast);
|
||||
QString getMultiCast();
|
||||
|
||||
NET_DVR_DEVICEINFO_V30 getDeviceInfo();
|
||||
|
||||
void setDeployState(int deployed);
|
||||
int getDeployState();
|
||||
|
||||
int modifyChannelDataChild(ChannelData *channel);
|
||||
|
||||
private:
|
||||
//<2F><><EFBFBD><EFBFBD>Ԥ<EFBFBD><D4A4><EFBFBD><EFBFBD>¼<EFBFBD><C2BC>0<EFBFBD><30>1<EFBFBD><31>
|
||||
int m_irealplaying;
|
||||
//<2F><>½<EFBFBD>豸<EFBFBD>ص<F3B7B5BB><D8B5>û<EFBFBD>ID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
int m_iuserid;
|
||||
//<2F><>½<EFBFBD>豸<EFBFBD><EFBFBD><F3B7B5BB>豸<EFBFBD><E8B1B8>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
NET_DVR_DEVICEINFO_V30 m_deviceinfo;
|
||||
//<2F>豸<EFBFBD><E8B1B8><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
QString m_qdevicename;
|
||||
//<2F>豸IP<49><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
QString m_qip;
|
||||
//<2F>豸<EFBFBD>˿<EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
int m_qiport;
|
||||
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
QString m_qusername;
|
||||
//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD>룬<EFBFBD><EBA3AC><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
QString m_qpassword;
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> >=0 <20><><EFBFBD><EFBFBD> -1
|
||||
int m_ideployed;
|
||||
//<2F>ಥip<69><70>ַ
|
||||
QString m_multiCast;
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD>ڵ<EFBFBD><DAB5>б<EFBFBD><D0B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҲҪ<D2B2><D2AA><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
QList<ChannelData> m_qlistchanneldata;
|
||||
};
|
||||
|
||||
#endif /* DEVICEDATA_H_ */
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
/***************************************************************************************
|
||||
* Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
|
||||
* FileName : treeitem.h
|
||||
* Description : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>ڵ<EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
|
||||
* Modification : <20><>
|
||||
* Version : V1.0.0
|
||||
* Time : 2009-10,11
|
||||
* Author : wanggp@hikvision.com
|
||||
**************************************************************************************/
|
||||
|
||||
|
||||
#include <QStringList>
|
||||
#include <QMessageBox>
|
||||
#include "treeitem.h"
|
||||
|
||||
/************************************************************************
|
||||
* Function : TreeItem
|
||||
* Description : <20><><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
* Input : data,parent
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
TreeItem::TreeItem(const QList<QVariant> &data, TreeItem *parent)
|
||||
{
|
||||
parentItem = parent;
|
||||
itemData = data;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : ~TreeItem
|
||||
* Description : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
TreeItem::~TreeItem()
|
||||
{
|
||||
qDeleteAll(childItems);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : appendChild
|
||||
* Description : <20><><EFBFBD>ӽڵ<D3BD>
|
||||
* Input : item
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
void TreeItem::appendChild(TreeItem *item)
|
||||
{
|
||||
childItems.append(item);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : child
|
||||
* Description : ȡ<><C8A1><EFBFBD>ӽ<EFBFBD><D3BD><EFBFBD>
|
||||
* Input : row
|
||||
* Output : <20><>
|
||||
* Return : childItems
|
||||
*************************************************************************/
|
||||
TreeItem *TreeItem::child(int row)
|
||||
{
|
||||
return childItems.value(row);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : childCount
|
||||
* Description : <20>ӽڵ<D3BD><DAB5><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
int TreeItem::childCount() const
|
||||
{
|
||||
return childItems.count();
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : columnCount
|
||||
* Description : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : <20>ӽڵ<D3BD><DAB5><EFBFBD><EFBFBD>ܸ<EFBFBD><DCB8><EFBFBD>
|
||||
*************************************************************************/
|
||||
int TreeItem::columnCount() const
|
||||
{
|
||||
return itemData.count();
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : data
|
||||
* Description : ijһ<C4B3><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : column
|
||||
* Output : <20><>
|
||||
* Return : itemData.value
|
||||
*************************************************************************/
|
||||
QVariant TreeItem::data(int column) const
|
||||
{
|
||||
QString data =itemData.value(column).toString();
|
||||
//QMessageBox::information(this,tr("TreeItem::data"),tr("data=%1").arg(data.toLatin1().data()));
|
||||
//printf("%s\n",data.toLatin1().data());
|
||||
return itemData.value(column);
|
||||
}
|
||||
|
||||
bool TreeItem::setData(const QVariant &value)
|
||||
{
|
||||
//printf("1232434534555=%s\n",value.toString().toLatin1().data());
|
||||
//itemData.clear();
|
||||
//itemData.append(value);
|
||||
//printf("1232434534555=%s\n",value.toString().toLatin1().data());
|
||||
|
||||
return true;
|
||||
|
||||
// return false;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : parent
|
||||
* Description : ȡ<>丸<EFBFBD>ڵ<EFBFBD>
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : parentItem
|
||||
*************************************************************************/
|
||||
TreeItem *TreeItem::parent()
|
||||
{
|
||||
return parentItem;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : row
|
||||
* Description : ͳ<><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : 0
|
||||
*************************************************************************/
|
||||
int TreeItem::row() const
|
||||
{
|
||||
if (parentItem)
|
||||
{
|
||||
return parentItem->childItems.indexOf(const_cast<TreeItem*>(this));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
/***************************************************************************************
|
||||
* Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
|
||||
* FileName : treeitem.h
|
||||
* Description : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾ<EFBFBD>ڵ<EFBFBD>ͷ<EFBFBD>ļ<EFBFBD>
|
||||
* Modification : <20><>
|
||||
* Version : V1.0.0
|
||||
* Time : 2009-10,11
|
||||
* Author : wanggp@hikvision.com
|
||||
**************************************************************************************/
|
||||
|
||||
#ifndef TREEITEM_H_
|
||||
#define TREEITEM_H_
|
||||
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
|
||||
class TreeItem
|
||||
{
|
||||
public:
|
||||
TreeItem(const QList<QVariant> &data, TreeItem *parent = 0);
|
||||
~TreeItem();
|
||||
|
||||
void appendChild(TreeItem *child);
|
||||
TreeItem *child(int row);
|
||||
int childCount() const;
|
||||
int columnCount() const;
|
||||
QVariant data(int column) const;
|
||||
bool setData(const QVariant &value);
|
||||
int row() const;
|
||||
TreeItem *parent();
|
||||
|
||||
private:
|
||||
//ÿ<><C3BF><EFBFBD>ڵ㶼<DAB5><E3B6BC><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӽڵ<D3BD><DAB5><EFBFBD><EFBFBD><EFBFBD>
|
||||
QList<TreeItem*> childItems;
|
||||
//<2F>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>ݣ<EFBFBD><DDA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD>͵ڶ<CDB5><DAB6><EFBFBD><EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
//QVariant<6E><74><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD>ṹ<EFBFBD><E1B9B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
QList<QVariant> itemData;
|
||||
TreeItem *parentItem;
|
||||
};
|
||||
#endif /* TREEITEM_H_ */
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
/***************************************************************************************
|
||||
* Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
|
||||
* FileName : treemodel.cpp
|
||||
* Description : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾģʽ<C4A3><CABD><EFBFBD><EFBFBD>treeview<65><77><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>
|
||||
* Modification : <20><>
|
||||
* Version : V1.0.0
|
||||
* Time : 2009-10,11
|
||||
* Author : wanggp@hikvision.com
|
||||
**************************************************************************************/
|
||||
#include <QIcon>
|
||||
#include <QtGui>
|
||||
#include "treeitem.h"
|
||||
#include "treemodel.h"
|
||||
|
||||
/************************************************************************
|
||||
* Function : TreeModel
|
||||
* Description : <20><><EFBFBD>캯<EFBFBD><ECBAAF>
|
||||
* Input : data parent
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
TreeModel::TreeModel(const QString &data, QObject *parent)
|
||||
: QStandardItemModel(parent)
|
||||
{
|
||||
QList<QVariant> rootData;
|
||||
rootData << "DeviceTree";
|
||||
rootItem = new TreeItem(rootData);
|
||||
setupModelData(data.split(QString("\n")), rootItem);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : ~TreeModel
|
||||
* Description : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
* Input : <20><>
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
TreeModel::~TreeModel()
|
||||
{
|
||||
delete rootItem;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : setupModelData
|
||||
* Description : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
|
||||
* Input : lines <20>豸<EFBFBD><E8B1B8>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>Ϣ
|
||||
parent <20>豸<EFBFBD>ڵ<EFBFBD>
|
||||
* Output : <20><>
|
||||
* Return : <20><>
|
||||
*************************************************************************/
|
||||
void TreeModel::setupModelData(const QStringList &lines, TreeItem *parent)
|
||||
{
|
||||
QList<TreeItem*> parents;
|
||||
parents << parent;
|
||||
QStandardItem *parentItem = invisibleRootItem();
|
||||
|
||||
//QStandardItem *devicetreenode = new QStandardItem(QString("HIKVISION"));
|
||||
//devicetreenode->setEditable(0);
|
||||
|
||||
|
||||
//add by pyd
|
||||
QStandardItem *pDeviceRootItem = new QStandardItem(QString("device tree(right click to add device)"));
|
||||
//devicetreenode->appendRow(pDeviceRootItem);
|
||||
parentItem->appendRow(pDeviceRootItem);
|
||||
pDeviceRootItem->setIcon(QIcon(":/images/tree.bmp"));
|
||||
pDeviceRootItem->setEditable(0);
|
||||
|
||||
QList<TreeItem*> parents1;
|
||||
QString deviceBegin("<device>");
|
||||
QString deviceEnd("</device>");
|
||||
QString channelBegin("<channel>");
|
||||
QString channelEnd("</channel>");
|
||||
|
||||
QStandardItem *pDeviceItem = NULL;
|
||||
QStandardItem *pChannelItem = NULL;
|
||||
for ( QStringList::const_iterator it = lines.begin(); it != lines.end(); ++it )
|
||||
{
|
||||
//<2F>豸<EFBFBD>ڵ<EFBFBD>
|
||||
if ((*it)==deviceBegin)
|
||||
{
|
||||
++it;
|
||||
pDeviceItem = new QStandardItem(*it);
|
||||
pDeviceRootItem->appendRow(pDeviceItem);
|
||||
pDeviceItem->setIcon(QIcon(":/images/logout.bmp"));
|
||||
pDeviceItem->setEditable(0);
|
||||
}
|
||||
|
||||
//ͨ<><CDA8><EFBFBD><EFBFBD>Ϣ
|
||||
QString chn =channelBegin;
|
||||
if ((*it)==chn)
|
||||
{
|
||||
++it;
|
||||
pChannelItem = new QStandardItem(*it);
|
||||
pDeviceItem->appendRow(pChannelItem);
|
||||
pChannelItem->setIcon(QIcon(":/images/camera.bmp"));
|
||||
pChannelItem->setEditable(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
/***************************************************************************************
|
||||
* Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
|
||||
* FileName : treemodel.h
|
||||
* Description : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʾģʽ<C4A3><CABD><EFBFBD><EFBFBD>treeview<65><77><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9>
|
||||
* Modification : <20><>
|
||||
* Version : V1.0.0
|
||||
* Time : 2009-10,11
|
||||
* Author : wanggp@hikvision.com
|
||||
**************************************************************************************/
|
||||
|
||||
#ifndef TREEMODEL_H_
|
||||
#define TREEMODEL_H_
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QModelIndex>
|
||||
#include <QVariant>
|
||||
#include <QString>
|
||||
#include <QObject>
|
||||
#include <QStringList>
|
||||
#include <QStandardItemModel>
|
||||
|
||||
|
||||
|
||||
class TreeItem;
|
||||
|
||||
class TreeModel : public QStandardItemModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
||||
void setupModelData(const QStringList &lines, TreeItem *parent);
|
||||
TreeModel(const QString &data, QObject *parent = 0);
|
||||
~TreeModel();
|
||||
|
||||
private:
|
||||
|
||||
TreeItem *rootItem;
|
||||
};
|
||||
|
||||
#endif /* TREEMODEL_H_ */
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
#include "alarmtable.h"
|
||||
|
||||
AlarmTable::AlarmTable(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
}
|
||||
|
||||
AlarmTable::~AlarmTable()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
#ifndef ALARMTABLE_H
|
||||
#define ALARMTABLE_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include "ui_alarmtable.h"
|
||||
#include "DemoPublic.h"
|
||||
|
||||
|
||||
class AlarmTable : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
friend unsigned int __stdcall MessCallBack(int lCommand, char *sDVRIP,
|
||||
char *pBuf, unsigned int dwBufLen);
|
||||
friend void __stdcall MessCallBack_V30(int lCommand, NET_DVR_ALARMER *pAlarmer,
|
||||
char *pAlarmInfo, unsigned int dwBufLen, void*pUser);
|
||||
friend class QtClientDemo;
|
||||
AlarmTable(QWidget *parent = 0);
|
||||
~AlarmTable();
|
||||
|
||||
public:
|
||||
Ui::AlarmTableClass ui;
|
||||
};
|
||||
|
||||
#endif // ALARMTABLE_H
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AlarmTableClass</class>
|
||||
<widget class="QWidget" name="AlarmTableClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>699</width>
|
||||
<height>87</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>AlarmTable</string>
|
||||
</property>
|
||||
<widget class="QTableWidget" name="tableWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>701</width>
|
||||
<height>89</height>
|
||||
</rect>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Time</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Alarm info</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Device info</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,42 @@
|
||||
#include "logtable.h"
|
||||
#include <QDateTime>
|
||||
#include <QTableWidgetItem>
|
||||
LogTable::LogTable(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
}
|
||||
|
||||
LogTable::~LogTable()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void LogTable::addLogAlarmInfo(int succ, const QString &interfacename, const QString &devinfo, const QString &errorinfo)
|
||||
//void LogTable::addLogAlarmInfo(int succ, QString interface, QString devinfo, QString errorinfo)
|
||||
{
|
||||
|
||||
QString currenttime = QDateTime::currentDateTime().toString(
|
||||
" yyyy/MM/dd hh:mm:ss");
|
||||
QTableWidgetItem *currtime = new QTableWidgetItem(currenttime);
|
||||
QTableWidgetItem *state =NULL;
|
||||
if (succ == 1)
|
||||
{
|
||||
state = new QTableWidgetItem("SUCC");
|
||||
}
|
||||
else
|
||||
{
|
||||
state = new QTableWidgetItem("FAILED");
|
||||
}
|
||||
QTableWidgetItem *func = new QTableWidgetItem(interfacename);
|
||||
QTableWidgetItem *ipinfo = new QTableWidgetItem(devinfo);
|
||||
QTableWidgetItem *error = new QTableWidgetItem(errorinfo);
|
||||
int row = ui.logtableWidget->rowCount();
|
||||
ui.logtableWidget->insertRow(row);
|
||||
ui.logtableWidget->setItem(row, 0, currtime);
|
||||
ui.logtableWidget->setItem(row, 1, state);
|
||||
ui.logtableWidget->setItem(row, 2, func);
|
||||
ui.logtableWidget->setItem(row, 3, ipinfo);
|
||||
ui.logtableWidget->setItem(row, 4, error);
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef LOGTABLE_H
|
||||
#define LOGTABLE_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
#include "ui_logtable.h"
|
||||
#include <QString>
|
||||
#include <QMessageBox>
|
||||
|
||||
#ifdef _WIN32
|
||||
#elif defined(__linux__) || defined(__APPLE__)
|
||||
#define __stdcall
|
||||
#endif
|
||||
|
||||
class LogTable : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
void addLogAlarmInfo(int succ, const QString &interfacename, const QString &devinfo, const QString &errorinfo);
|
||||
friend class QtClientDemo;
|
||||
friend class RealPlay;
|
||||
friend class PlayBack;
|
||||
//friend unsigned int __stdcall MessCallBack(int lCommand, char *sDVRIP, char *pBuf, unsigned int dwBufLen);
|
||||
LogTable(QWidget *parent = 0);
|
||||
~LogTable();
|
||||
|
||||
//void addLogAlarmInfo(int succ, QString interface, QString devinfo, QString errorinfo);
|
||||
|
||||
private:
|
||||
Ui::LogTableClass ui;
|
||||
};
|
||||
|
||||
#endif // LOGTABLE_H
|
||||
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>LogTableClass</class>
|
||||
<widget class="QWidget" name="LogTableClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>701</width>
|
||||
<height>87</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>LogTable</string>
|
||||
</property>
|
||||
<widget class="QTableWidget" name="logtableWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>701</width>
|
||||
<height>89</height>
|
||||
</rect>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>time</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>state</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>operation</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>devicee info</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>error info</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,278 @@
|
||||
/************************************************************************
|
||||
* Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
|
||||
* FileName : devicestate.cpp
|
||||
* Description : devicestate show
|
||||
* Modification History : none
|
||||
* Version : V1.0
|
||||
* Time : 2009-11,12
|
||||
* Author : wanggongpu
|
||||
* Descrp :
|
||||
*************************************************************************/
|
||||
#include "devicestate.h"
|
||||
#include <QMessageBox>
|
||||
#include <QTableWidgetItem>
|
||||
|
||||
/************************************************************************
|
||||
* Function : DeviceState
|
||||
* Description : instructor
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
DeviceState::DeviceState(QList<DeviceData> *devicetree, int* userid, QDialog *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
m_dsuserid = userid;
|
||||
m_dsdevicetree =devicetree;
|
||||
|
||||
QList<DeviceData>::iterator it;
|
||||
for ( it = (*m_dsdevicetree).begin(); it != (*m_dsdevicetree).end(); ++it)
|
||||
{
|
||||
if ((*it).getUsrID()==(*m_dsuserid))
|
||||
{
|
||||
ui.lineEdit_nodename->setText((*it).getDeviceName());
|
||||
ui.lineEdit_deviceIP->setText((*it).getIP());
|
||||
|
||||
if (!NET_DVR_GetDVRWorkState(*m_dsuserid, &m_dsworkstate))
|
||||
{
|
||||
QMessageBox::information(this,tr("NET_DVR_GetDVRWorkState failed"), \
|
||||
tr("SDK_Last_Error =%1").arg(NET_DVR_GetLastError()));
|
||||
return ;
|
||||
}
|
||||
printDVRState(&m_dsworkstate);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : ~DeviceState
|
||||
* Description : destructor
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
DeviceState::~DeviceState()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : printDVRState
|
||||
* Description : print the dvr state info
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
void DeviceState::printDVRState(LPNET_DVR_WORKSTATE pworkstate)
|
||||
{
|
||||
|
||||
QString state;
|
||||
/*0<><30><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31>CPUռ<55><D5BC><EFBFBD><EFBFBD>̫<EFBFBD>ߣ<EFBFBD><DFA3><EFBFBD><EFBFBD><EFBFBD>85%<25><>2<EFBFBD><32>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>紮<EFBFBD><E7B4AE><EFBFBD>쳣*/
|
||||
switch (pworkstate->dwDeviceStatic)
|
||||
{
|
||||
case 0:
|
||||
state.append("Normal");
|
||||
break;
|
||||
|
||||
case 1:
|
||||
state.append("CPU Plus 85%");
|
||||
break;
|
||||
|
||||
case 2:
|
||||
state.append("Hardware Error");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
ui.lineEdit_devicestate->setText(state);
|
||||
|
||||
insertChannelState( pworkstate);
|
||||
insertDiskState( pworkstate);
|
||||
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : insertChannelState
|
||||
* Description : insert item to table
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
void DeviceState::insertChannelState( LPNET_DVR_WORKSTATE pworkstate)
|
||||
{
|
||||
int i=0;
|
||||
int j=0;
|
||||
int row=0;
|
||||
for (i=0; i<MAX_CHANNUM; i++)
|
||||
{
|
||||
QTableWidgetItem *DiskNum = new QTableWidgetItem(tr("Cameral%1").arg(int(i+1)));
|
||||
DiskNum->setFlags(Qt::ItemIsEnabled);
|
||||
QTableWidgetItem *RecordStatic ;
|
||||
if (int(pworkstate->struChanStatic[i].byRecordStatic)==0)
|
||||
{
|
||||
RecordStatic = new QTableWidgetItem(tr("%1").arg("Not record"));
|
||||
}
|
||||
else
|
||||
{
|
||||
RecordStatic = new QTableWidgetItem(tr("%1").arg("Record"));
|
||||
}
|
||||
RecordStatic->setFlags(Qt::ItemIsEnabled);
|
||||
QTableWidgetItem *SignalStatic ;
|
||||
if (pworkstate->struChanStatic[i].bySignalStatic==0)
|
||||
{
|
||||
SignalStatic= new QTableWidgetItem(tr("%1").arg("Record"));
|
||||
}
|
||||
else
|
||||
{
|
||||
SignalStatic= new QTableWidgetItem(tr("%1").arg("<EFBFBD>źŶ<EFBFBD>ʧ"));
|
||||
}
|
||||
SignalStatic->setFlags(Qt::ItemIsEnabled);
|
||||
|
||||
QTableWidgetItem *HardwareStatic;
|
||||
if (pworkstate->struChanStatic[i].byHardwareStatic==0)
|
||||
{
|
||||
HardwareStatic= new QTableWidgetItem(tr("%1").arg("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"));
|
||||
}
|
||||
else
|
||||
{
|
||||
HardwareStatic= new QTableWidgetItem(tr("%1").arg("<EFBFBD>쳣"));
|
||||
}
|
||||
HardwareStatic->setFlags(Qt::ItemIsEnabled);
|
||||
|
||||
QTableWidgetItem *BitRate = new QTableWidgetItem(tr("%1 "\
|
||||
).arg(int(pworkstate->struChanStatic[i].dwBitRate)));
|
||||
BitRate->setFlags(Qt::ItemIsEnabled);
|
||||
|
||||
QTableWidgetItem *LinkNum = new QTableWidgetItem(tr("%1 "\
|
||||
).arg(int(pworkstate->struChanStatic[i].dwLinkNum)));
|
||||
LinkNum->setFlags(Qt::ItemIsEnabled);
|
||||
|
||||
row = ui.channeltableWidget->rowCount();
|
||||
ui.channeltableWidget->insertRow(row);
|
||||
|
||||
ui.channeltableWidget->setItem(row, 0, DiskNum);
|
||||
ui.channeltableWidget->setItem(row, 1, RecordStatic);
|
||||
ui.channeltableWidget->setItem(row, 2, SignalStatic);
|
||||
ui.channeltableWidget->setItem(row, 3, HardwareStatic);
|
||||
ui.channeltableWidget->setItem(row, 4, LinkNum);
|
||||
ui.channeltableWidget->setItem(row, 5, BitRate);
|
||||
|
||||
j+=pworkstate->struChanStatic[i].dwLinkNum;
|
||||
|
||||
}
|
||||
QString string = QString::number(j);
|
||||
ui.lineEdit_totalconnum->setText(string);
|
||||
return ;
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : insertDiskState
|
||||
* Description : add item to table
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
void DeviceState::insertDiskState( LPNET_DVR_WORKSTATE pworkstate)
|
||||
{
|
||||
int row ;
|
||||
int i;
|
||||
|
||||
for (i=0; i<MAX_DISKNUM; i++)//Ӳ<><D3B2>״̬
|
||||
{
|
||||
QTableWidgetItem *hisknum = new QTableWidgetItem(tr("DISK%1").arg(int(i+1)));
|
||||
hisknum->setFlags(Qt::ItemIsEnabled);
|
||||
|
||||
QTableWidgetItem *disksize = new
|
||||
QTableWidgetItem(tr("%1").arg(int(pworkstate->struHardDiskStatic[i].dwVolume)));
|
||||
disksize->setFlags(Qt::ItemIsEnabled);
|
||||
|
||||
QTableWidgetItem *freesize = new
|
||||
QTableWidgetItem(tr("%1").arg(int(pworkstate->struHardDiskStatic[i].dwFreeSpace)));
|
||||
freesize->setFlags(Qt::ItemIsEnabled);
|
||||
|
||||
QString diskstate;
|
||||
if ((pworkstate->struHardDiskStatic[i].dwVolume!=0)
|
||||
&&(pworkstate->struHardDiskStatic[i].dwHardDiskStatic == 0))
|
||||
{
|
||||
diskstate.append("<EFBFBD>");
|
||||
}
|
||||
else
|
||||
{
|
||||
diskstate =QString::number(int(pworkstate->struHardDiskStatic[i].dwFreeSpace));
|
||||
}
|
||||
QTableWidgetItem *diskstatic = new QTableWidgetItem(diskstate);
|
||||
diskstatic->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
diskstatic->setFlags(Qt::ItemIsEnabled);
|
||||
|
||||
row = ui.disktableWidget->rowCount();
|
||||
ui.disktableWidget->insertRow(row);
|
||||
|
||||
ui.disktableWidget->setItem(row, 0, hisknum);
|
||||
ui.disktableWidget->setItem(row, 1, disksize);
|
||||
ui.disktableWidget->setItem(row, 2, freesize);
|
||||
ui.disktableWidget->setItem(row, 3, diskstatic);
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : on_pushButton_refresh_clicked
|
||||
* Description : refresh the dialogue
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
void DeviceState::on_pushButton_refresh_clicked()
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
for (int i=0; i<ui.disktableWidget->rowCount(); i++)
|
||||
{
|
||||
for (int j=0;j<ui.disktableWidget->columnCount();j++ )
|
||||
{
|
||||
delete ui.disktableWidget->takeItem(i, j);
|
||||
}
|
||||
ui.disktableWidget->removeRow(i);
|
||||
}
|
||||
|
||||
ui.disktableWidget->setRowCount(0);
|
||||
|
||||
for (int i=0; i<ui.channeltableWidget->rowCount(); i++)
|
||||
{
|
||||
for (int j=0;j<ui.channeltableWidget->columnCount();j++ )
|
||||
{
|
||||
delete ui.channeltableWidget->takeItem(i, j);
|
||||
}
|
||||
ui.channeltableWidget->removeRow(i);
|
||||
}
|
||||
|
||||
ui.channeltableWidget->setRowCount(0);
|
||||
|
||||
if (!NET_DVR_GetDVRWorkState(*m_dsuserid, &m_dsworkstate))
|
||||
{
|
||||
QMessageBox::information(this,tr("NET_DVR_GetDVRWorkState failed"), \
|
||||
tr("SDK_Last_Error =%1").arg(NET_DVR_GetLastError()));
|
||||
return ;
|
||||
}
|
||||
printDVRState(&m_dsworkstate);
|
||||
return;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : on_pushButton_exit_clicked
|
||||
* Description : exit the dialogue
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
void DeviceState::on_pushButton_exit_clicked()
|
||||
{
|
||||
close();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
/************************************************************************
|
||||
* Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
|
||||
* FileName :
|
||||
* Description :
|
||||
* Modification History :
|
||||
* Version : V1.0
|
||||
* Time : 2009-11,12
|
||||
* Author : wanggongpu
|
||||
* Descrp :
|
||||
*************************************************************************/
|
||||
#ifndef DEVICESTATE_H
|
||||
#define DEVICESTATE_H
|
||||
#include <QDialog>
|
||||
#include <QList>
|
||||
#include <QtGui/QWidget>
|
||||
#include "ui_devicestate.h"
|
||||
#include "DemoPublic.h"
|
||||
#include "devicedata.h"
|
||||
|
||||
class DeviceState : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DeviceState(QList<DeviceData> *devicetree, int* userid, QDialog *parent = 0);
|
||||
~DeviceState();
|
||||
void printDVRState(LPNET_DVR_WORKSTATE pworkstate);
|
||||
void insertChannelState( LPNET_DVR_WORKSTATE pworkstate);
|
||||
void insertDiskState( LPNET_DVR_WORKSTATE pworkstate);
|
||||
|
||||
private slots:
|
||||
void on_pushButton_refresh_clicked();
|
||||
void on_pushButton_exit_clicked();
|
||||
|
||||
|
||||
private:
|
||||
Ui::DeviceStateClass ui;
|
||||
int* m_dsuserid;
|
||||
QList<DeviceData> *m_dsdevicetree;
|
||||
NET_DVR_WORKSTATE m_dsworkstate;
|
||||
};
|
||||
#endif // DEVICESTATE_H
|
||||
|
||||
@@ -0,0 +1,440 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DeviceStateClass</class>
|
||||
<widget class="QWidget" name="DeviceStateClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>827</width>
|
||||
<height>607</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>DeviceState</string>
|
||||
</property>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>60</y>
|
||||
<width>81</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Channel state</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_totalconnum">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>650</x>
|
||||
<y>30</y>
|
||||
<width>61</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Total link</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_devicestate">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>470</x>
|
||||
<y>30</y>
|
||||
<width>61</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Device state</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_6">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>320</y>
|
||||
<width>681</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_5">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>550</y>
|
||||
<width>771</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>140</x>
|
||||
<y>60</y>
|
||||
<width>651</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_devicestate">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>540</x>
|
||||
<y>30</y>
|
||||
<width>91</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>310</y>
|
||||
<width>771</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_totalconnum">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>710</x>
|
||||
<y>30</y>
|
||||
<width>61</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_nodename">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>30</y>
|
||||
<width>141</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTableWidget" name="disktableWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>340</y>
|
||||
<width>751</width>
|
||||
<height>211</height>
|
||||
</rect>
|
||||
</property>
|
||||
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||
<number>100</number>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderDefaultSectionSize">
|
||||
<number>100</number>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>HD No.</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>HD capacity(MB)</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Last capacity(MB)</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>HD state</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_nodename">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>30</y>
|
||||
<width>81</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Device name</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_7">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>330</y>
|
||||
<width>21</width>
|
||||
<height>231</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTableWidget" name="channeltableWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>80</y>
|
||||
<width>751</width>
|
||||
<height>231</height>
|
||||
</rect>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Channel No.</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Record state</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Signal state</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Hardware state</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Link number</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Current bitrate</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>IPC links</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_exit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>690</x>
|
||||
<y>570</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Exit</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_9">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>90</x>
|
||||
<y>10</y>
|
||||
<width>721</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_8">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>780</x>
|
||||
<y>330</y>
|
||||
<width>21</width>
|
||||
<height>231</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_deviceIP">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>260</x>
|
||||
<y>30</y>
|
||||
<width>71</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Device IP</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>70</y>
|
||||
<width>21</width>
|
||||
<height>251</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>780</x>
|
||||
<y>70</y>
|
||||
<width>21</width>
|
||||
<height>251</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>81</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Device state</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_11">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>800</x>
|
||||
<y>20</y>
|
||||
<width>20</width>
|
||||
<height>571</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>50</x>
|
||||
<y>320</y>
|
||||
<width>61</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>HDD state</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_10">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>20</y>
|
||||
<width>20</width>
|
||||
<height>571</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_refresh">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>570</x>
|
||||
<y>570</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Update</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" name="lineEdit_deviceIP">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>330</x>
|
||||
<y>30</y>
|
||||
<width>131</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_12">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>590</y>
|
||||
<width>801</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_13">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>320</y>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="Line" name="line_14">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>60</y>
|
||||
<width>21</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,144 @@
|
||||
/************************************************************************
|
||||
* Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
|
||||
* FileName : formatdisk.cpp
|
||||
* Description : format disk
|
||||
* Modification History : none
|
||||
* Version : V1.0
|
||||
* Time : 2009-11,12
|
||||
* Author : wanggongpu
|
||||
* Descrp :
|
||||
*************************************************************************/
|
||||
#include "formatdisk.h"
|
||||
#include <QString>
|
||||
#include <QMessageBox>
|
||||
#include "common.h"
|
||||
#include <unistd.h>
|
||||
/************************************************************************
|
||||
* Function : FormatDisk
|
||||
* Description : instructor
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
FormatDisk::FormatDisk(int *userid, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
m_fduserid =userid;
|
||||
DWORD returnbytes =0;
|
||||
|
||||
if (!NET_DVR_GetDVRConfig(*m_fduserid, NET_DVR_GET_HDCFG,\
|
||||
0xFFFFFFFF, &m_fdhdcfg, sizeof(NET_DVR_HDCFG),&returnbytes))
|
||||
{
|
||||
QMessageBox::information(this,tr("NET_DVR_GetDVRConfig failed"), \
|
||||
tr("SDK_Last_Error =%1").arg(NET_DVR_GetLastError()));
|
||||
return ;
|
||||
}
|
||||
QString all("All Disks");
|
||||
ui.comboBox->addItem(all);
|
||||
|
||||
m_disknum[0]=0xff;
|
||||
int j=0;
|
||||
for (int i=0;i<m_fdhdcfg.dwHDCount;i++,j++)
|
||||
{
|
||||
m_disknum[++j]=m_fdhdcfg.struHDInfo[i].dwHDNo;
|
||||
ui.comboBox->addItem(QString::number(m_fdhdcfg.struHDInfo[i].dwHDNo));
|
||||
}
|
||||
ui.horizontalSlider->setRange(0, 100);
|
||||
setUpdatesEnabled ( TRUE );
|
||||
update();
|
||||
repaint();
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : ~FormatDisk
|
||||
* Description : destructor
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
FormatDisk::~FormatDisk()
|
||||
{
|
||||
for (int i=0;i<=m_indexnum;i++)
|
||||
{
|
||||
ui.comboBox->removeItem (i);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function :
|
||||
* Description :
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
void FormatDisk::on_comboBox_currentIndexChanged ( int index)
|
||||
{
|
||||
m_fdindex =index;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : on_pushButton_format_clicked
|
||||
* Description : format
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
void FormatDisk::on_pushButton_format_clicked()
|
||||
{
|
||||
int format=0;
|
||||
if (m_fdindex!=0)
|
||||
{
|
||||
m_disknum[m_fdindex] = m_fdindex;
|
||||
}
|
||||
|
||||
format = NET_DVR_FormatDisk(*m_fduserid, m_disknum[m_fdindex]);
|
||||
if (format < 0)
|
||||
{
|
||||
QMessageBox::information(this,tr("NET_DVR_FormatDisk failed"), \
|
||||
tr("SDK_Last_Error =%1").arg(NET_DVR_GetLastError()));
|
||||
return ;
|
||||
}
|
||||
|
||||
LONG pos = 0;
|
||||
LONG pstatic = 0;
|
||||
while (pstatic != 1)
|
||||
{
|
||||
#if (defined(_WIN32))
|
||||
#elif defined(__linux__)
|
||||
sleep(1);
|
||||
#endif
|
||||
|
||||
if (!NET_DVR_GetFormatProgress(format,&m_disknum[m_fdindex],&pos, &pstatic))
|
||||
{
|
||||
QMessageBox::information(this,tr("NET_DVR_GetFormatProgress failed"), \
|
||||
tr("SDK_Last_Error =%1").arg(NET_DVR_GetLastError()));
|
||||
//return ;
|
||||
}
|
||||
|
||||
ui.horizontalSlider->setValue(pos++);
|
||||
if (pstatic !=0)
|
||||
{
|
||||
ui.horizontalSlider->setValue(100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
NET_DVR_CloseFormatHandle(format);
|
||||
QMessageBox::information(this,tr("NET_DVR_GetFormatProgress"), \
|
||||
tr("FORMAT SUCCESS OVER format=%1 ").arg(format));
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : on_pushButton_exit_clicked
|
||||
* Description : exit
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
void FormatDisk::on_pushButton_exit_clicked()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
/************************************************************************
|
||||
* Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
|
||||
* FileName : formatdisk.h
|
||||
* Description : format disk
|
||||
* Modification History : none
|
||||
* Version : V1.0
|
||||
* Time : 2009-11,12
|
||||
* Author : wanggongpu
|
||||
* Descrp :
|
||||
*************************************************************************/
|
||||
#ifndef FORMATDISK_H
|
||||
#define FORMATDISK_H
|
||||
|
||||
#include <QtGui/QDialog>
|
||||
#include "ui_formatdisk.h"
|
||||
#include "DemoPublic.h"
|
||||
|
||||
class FormatDisk : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
FormatDisk(int *userid, QWidget *parent = 0);
|
||||
~FormatDisk();
|
||||
private slots:
|
||||
void on_comboBox_currentIndexChanged ( int index);
|
||||
void on_pushButton_format_clicked();
|
||||
void on_pushButton_exit_clicked();
|
||||
private:
|
||||
Ui::FormatDiskClass ui;
|
||||
|
||||
int * m_fduserid;
|
||||
NET_DVR_HDCFG m_fdhdcfg;
|
||||
int m_fdindex;
|
||||
LONG m_disknum[MAX_DISKNUM_V30];
|
||||
int m_indexnum;
|
||||
};
|
||||
|
||||
#endif // FORMATDISK_H
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FormatDiskClass</class>
|
||||
<widget class="QDialog" name="FormatDiskClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>379</width>
|
||||
<height>241</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>FormatDisk</string>
|
||||
</property>
|
||||
<widget class="QComboBox" name="comboBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>150</x>
|
||||
<y>40</y>
|
||||
<width>151</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>40</y>
|
||||
<width>91</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'宋体'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt;">Disk</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_format">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>100</y>
|
||||
<width>75</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Format</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_exit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>220</x>
|
||||
<y>100</y>
|
||||
<width>81</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Exit</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QSlider" name="horizontalSlider">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>40</x>
|
||||
<y>140</y>
|
||||
<width>261</width>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -0,0 +1,374 @@
|
||||
/************************************************************************
|
||||
* Copyright 2009-2011 Hikvision Digital Technology Co., Ltd.
|
||||
* FileName : logsearch.cpp
|
||||
* Description : log search
|
||||
* Modification History : none
|
||||
* Version : V1.0
|
||||
* Time : 2009-11,12
|
||||
* Author : wanggongpu
|
||||
* Descrp :
|
||||
*************************************************************************/
|
||||
#include "logsearch.h"
|
||||
#include <QMessageBox>
|
||||
#include <QTableWidgetItem>
|
||||
#include <QString>
|
||||
#include "common.h"
|
||||
|
||||
/************************************************************************
|
||||
* Function : LogSearch
|
||||
* Description : instructor
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
LogSearch::LogSearch(QList<DeviceData> *devicetree, int* userid, QDialog *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
m_lsuserid = userid;
|
||||
m_lsdevicetree =devicetree;
|
||||
|
||||
QList<DeviceData>::iterator it;
|
||||
for ( it = (*m_lsdevicetree).begin(); it != (*m_lsdevicetree).end(); ++it)
|
||||
{
|
||||
if ((*it).getUsrID()==(*m_lsuserid))
|
||||
{
|
||||
ui.lineEdit_nodename->setText((*it).getDeviceName());
|
||||
ui.lineEdit_deviceIP->setText((*it).getIP());
|
||||
ui.lineEdit_nodename->setDisabled(1);
|
||||
ui.lineEdit_deviceIP->setDisabled(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QDate startdate = QDateTime::currentDateTime().date();
|
||||
QDate stopdate = QDateTime::currentDateTime().date();
|
||||
QTime starttime(0, 0, 0);
|
||||
QTime stoptime(23, 59, 59);
|
||||
ui.dateTimeEdit_start->setDate(startdate);
|
||||
ui.dateTimeEdit_start->setTime(starttime);
|
||||
ui.dateTimeEdit_stop->setDate(stopdate);
|
||||
ui.dateTimeEdit_stop->setTime(stoptime);
|
||||
|
||||
|
||||
ui.comboBox_logtype->setCurrentIndex(2);
|
||||
m_lsmode = 2;
|
||||
ui.comboBox_maintype->setCurrentIndex(0);
|
||||
m_lsmaintype = 0;
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : ~LogSearch
|
||||
* Description : destructor
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
LogSearch::~LogSearch()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : on_comboBox_logtype_currentIndexChanged
|
||||
* Description : change log type
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
void LogSearch::on_comboBox_logtype_currentIndexChanged (int index)
|
||||
{
|
||||
m_lsmode = index;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : on_comboBox_maintype_currentIndexChanged
|
||||
* Description : change the main type
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
void LogSearch::on_comboBox_maintype_currentIndexChanged ( int index)
|
||||
{
|
||||
m_lsmaintype = index;
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : on_comboBox_subtype_currentIndexChanged
|
||||
* Description : change the sub type
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
void LogSearch::on_comboBox_subtype_currentIndexChanged (int index)
|
||||
{
|
||||
if (index ==0)
|
||||
{
|
||||
m_lssubtype =0x1;
|
||||
}
|
||||
else if ((index >0)&&(index <=8))
|
||||
{
|
||||
m_lssubtype =index;
|
||||
}
|
||||
else if ((index >=10)&&(index <=20))
|
||||
{
|
||||
m_lssubtype = 0x20 - 9 + index;
|
||||
}
|
||||
else if((index >=22)&&(index <=25))
|
||||
{
|
||||
m_lssubtype = 0x40 - 21 + index;
|
||||
}
|
||||
else if((index >=26)&&(index <=41))
|
||||
{
|
||||
m_lssubtype = 0x50 - 26 + index;
|
||||
}
|
||||
else if((index >=42)&&(index <=54))
|
||||
{
|
||||
m_lssubtype = 0x60 - 42 + index;
|
||||
}
|
||||
else if((index >=55)&&(index <=86))
|
||||
{
|
||||
m_lssubtype = 0x70 - 55 + index;
|
||||
}
|
||||
else if((index >=88)&&(index <=95))
|
||||
{
|
||||
m_lssubtype = 0xa1 - 88 + index;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_lssubtype =0x1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : on_dateTimeEdit_start_dateTimeChanged
|
||||
* Description : change the date time info
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
void LogSearch::on_dateTimeEdit_start_dateTimeChanged ( const QDateTime & datetime )
|
||||
{
|
||||
m_lsstarttime.dwYear = datetime.date().year();
|
||||
m_lsstarttime.dwMonth = datetime.date().month();
|
||||
m_lsstarttime.dwDay = datetime.date().day();
|
||||
m_lsstarttime.dwHour = datetime.time().hour();
|
||||
m_lsstarttime.dwMinute = datetime.time().minute();
|
||||
m_lsstarttime.dwSecond = datetime.time().second();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : on_dateTimeEdit_stop_dateTimeChanged
|
||||
* Description : change the date time info
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
void LogSearch::on_dateTimeEdit_stop_dateTimeChanged ( const QDateTime & datetime )
|
||||
{
|
||||
m_lsstoptime.dwYear = datetime.date().year();
|
||||
m_lsstoptime.dwMonth = datetime.date().month();
|
||||
m_lsstoptime.dwDay = datetime.date().day();
|
||||
m_lsstoptime.dwHour = datetime.time().hour();
|
||||
m_lsstoptime.dwMinute = datetime.time().minute();
|
||||
m_lsstoptime.dwSecond = datetime.time().second();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : on_pushButton_searchlog_clicked
|
||||
* Description : sure search
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
void LogSearch::on_pushButton_searchlog_clicked()
|
||||
{
|
||||
int logsearchhandle=0;
|
||||
|
||||
for (int i=0; i<ui.logtableWidget->rowCount(); i++)
|
||||
{
|
||||
for (int j=0;j<ui.logtableWidget->columnCount();j++ )
|
||||
{
|
||||
delete ui.logtableWidget->takeItem(i, j);
|
||||
}
|
||||
ui.logtableWidget->removeRow(i);
|
||||
}
|
||||
ui.logtableWidget->setRowCount(0);
|
||||
|
||||
int smart =0;
|
||||
if (ui.checkBox_smart->checkState()==2)
|
||||
{
|
||||
smart =1;
|
||||
}
|
||||
logsearchhandle = NET_DVR_FindDVRLog_V30(*m_lsuserid, m_lsmode,
|
||||
m_lsmaintype,m_lssubtype,&m_lsstarttime,&m_lsstoptime,smart);
|
||||
|
||||
if (logsearchhandle == -1)
|
||||
{
|
||||
QMessageBox::information(this,tr("NET_DVR_FindDVRLog_V30 failed"), \
|
||||
tr("SDK_Last_Error =%1").arg(NET_DVR_GetLastError()));
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
int nextreturn=0;
|
||||
NET_DVR_LOG_V30* LogData =NULL;
|
||||
LogData = (NET_DVR_LOG_V30* )malloc(sizeof(NET_DVR_LOG_V30));
|
||||
memset(LogData,0x0,sizeof(NET_DVR_LOG_V30));
|
||||
while (nextreturn !=-1)
|
||||
{
|
||||
nextreturn = NET_DVR_FindNextLog_V30(logsearchhandle, LogData);
|
||||
if (nextreturn < 0)
|
||||
{
|
||||
QMessageBox::information(this,tr("NET_DVR_FindDVRLog_V30 failed"), \
|
||||
tr("SDK_Last_Error =%1").arg(NET_DVR_GetLastError()));
|
||||
return ;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
switch (nextreturn)
|
||||
{
|
||||
case NET_DVR_FILE_SUCCESS:
|
||||
|
||||
printTable(LogData);
|
||||
break;
|
||||
case NET_DVR_FILE_NOFIND:
|
||||
QMessageBox::information(this,tr("NET_DVR_FindDVRLog_V30"),
|
||||
tr("NET_DVR_FILE_NOFIND"));
|
||||
NET_DVR_FindLogClose_V30(logsearchhandle);
|
||||
free(LogData);
|
||||
return;
|
||||
case NET_DVR_ISFINDING:
|
||||
break;
|
||||
case NET_DVR_NOMOREFILE :
|
||||
QMessageBox::information(this,tr("NET_DVR_FindDVRLog_V30"),
|
||||
tr("NET_DVR_NOMOREFILE"));
|
||||
NET_DVR_FindLogClose_V30(logsearchhandle);
|
||||
free(LogData);
|
||||
return;
|
||||
case NET_DVR_FILE_EXCEPTION :
|
||||
QMessageBox::information(this,tr("NET_DVR_FindDVRLog_V30"),
|
||||
tr("NET_DVR_FILE_EXCEPTION"));
|
||||
//NET_DVR_FindLogClose_V30(logsearchhandle);
|
||||
free(LogData);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
free(LogData);
|
||||
NET_DVR_FindLogClose_V30(logsearchhandle);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : printTable
|
||||
* Description : show the item of search result in table
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
void LogSearch::printTable(NET_DVR_LOG_V30* LogData)
|
||||
{
|
||||
int row=0;
|
||||
row = ui.logtableWidget->rowCount();
|
||||
QString datetimeinfo;
|
||||
datetimeinfo.append(QString::number(LogData->strLogTime.dwYear));
|
||||
datetimeinfo.append("-");
|
||||
datetimeinfo.append(QString::number(LogData->strLogTime.dwMonth));
|
||||
datetimeinfo.append("-");
|
||||
datetimeinfo.append(QString::number(LogData->strLogTime.dwDay));
|
||||
datetimeinfo.append(" ");
|
||||
datetimeinfo.append(QString::number(LogData->strLogTime.dwHour));
|
||||
datetimeinfo.append(":");
|
||||
datetimeinfo.append(QString::number(LogData->strLogTime.dwMinute));
|
||||
datetimeinfo.append(":");
|
||||
datetimeinfo.append(QString::number(LogData->strLogTime.dwSecond));
|
||||
QTableWidgetItem *datetime = new QTableWidgetItem(tr("%1").arg(datetimeinfo));
|
||||
datetime->setFlags(Qt::ItemIsEnabled);
|
||||
|
||||
QString majortype;
|
||||
switch(int(LogData->dwMajorType))
|
||||
{
|
||||
/*
|
||||
MAJOR_ALARM 0x1 <20><><EFBFBD><EFBFBD>
|
||||
MAJOR_EXCEPTION 0x2 <20>쳣
|
||||
MAJOR_OPERATION 0x3 <20><><EFBFBD><EFBFBD>
|
||||
MAJOR_INFORMATION 0x4 <20><>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
*/
|
||||
case 1:
|
||||
majortype.append("MAJOR_ALARM");
|
||||
break;
|
||||
case 2:
|
||||
majortype.append("MAJOR_EXCEPTION");
|
||||
break;
|
||||
case 3:
|
||||
majortype.append("MAJOR_OPERATION");
|
||||
break;
|
||||
case 4:
|
||||
majortype.append("MAJOR_INFORMATION");
|
||||
break;
|
||||
default:
|
||||
majortype.append("UNKOWN_TYPE");
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
QTableWidgetItem *maintype = new QTableWidgetItem(majortype);
|
||||
maintype->setFlags(Qt::ItemIsEnabled);
|
||||
|
||||
QTableWidgetItem *subtype = new QTableWidgetItem(tr("%1 ").arg(int(LogData->dwMinorType)));
|
||||
subtype->setFlags(Qt::ItemIsEnabled);
|
||||
|
||||
QTableWidgetItem *remotehost = new
|
||||
QTableWidgetItem(tr("%1").arg(LogData->struRemoteHostAddr.sIpV4));
|
||||
remotehost->setFlags(Qt::ItemIsEnabled);
|
||||
|
||||
QTableWidgetItem *description;
|
||||
char *info=NULL;
|
||||
info= new char[LOG_INFO_LEN];
|
||||
if (LogData->dwInfoLen != 0)
|
||||
{
|
||||
memcpy(info,&LogData->sInfo,sizeof(char)*(LogData->dwInfoLen));
|
||||
description = new QTableWidgetItem(tr("%1").arg(info));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
description = new QTableWidgetItem("");
|
||||
}
|
||||
|
||||
description->setFlags(Qt::ItemIsEnabled);
|
||||
description->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
|
||||
|
||||
|
||||
ui.logtableWidget->insertRow(row);
|
||||
ui.logtableWidget->setItem(row, 0, datetime);
|
||||
ui.logtableWidget->setItem(row, 1, maintype);
|
||||
ui.logtableWidget->setItem(row, 2, subtype);
|
||||
ui.logtableWidget->setItem(row, 3, remotehost);
|
||||
ui.logtableWidget->setItem(row, 4, description);
|
||||
delete []info;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
* Function : on_pushButton_exit_clicked
|
||||
* Description : exit
|
||||
* Input : none
|
||||
* Output : none
|
||||
* Return : none
|
||||
*************************************************************************/
|
||||
void LogSearch::on_pushButton_exit_clicked()
|
||||
{
|
||||
close();
|
||||
}
|
||||
|
||||