Update MediaClient
This commit is contained in:
@@ -0,0 +1,320 @@
|
||||
/***************************************************************************************
|
||||
*
|
||||
* IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
|
||||
*
|
||||
* By downloading, copying, installing or using the software you agree to this license.
|
||||
* If you do not agree to this license, do not download, install,
|
||||
* copy or use the software.
|
||||
*
|
||||
* Copyright (C) 2014-2024, Happytimesoft Corporation, all rights reserved.
|
||||
*
|
||||
* Redistribution and use in binary forms, with or without modification, are permitted.
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed
|
||||
* under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
||||
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
|
||||
* language governing permissions and limitations under the License.
|
||||
*
|
||||
****************************************************************************************/
|
||||
|
||||
#include "sys_inc.h"
|
||||
#include "http.h"
|
||||
#include "http_parse.h"
|
||||
#include "onvif.h"
|
||||
#include "onvif_event.h"
|
||||
#include "onvif_api.h"
|
||||
|
||||
/***************************************************************************************/
|
||||
|
||||
ONVIF_DEVICE g_device;
|
||||
ONVIF_DEVICE g_device2;
|
||||
|
||||
#define MAX_DEV_NUMS 10
|
||||
|
||||
/***************************************************************************************/
|
||||
|
||||
int getDeviceIndex(ONVIF_DEVICE * p_device)
|
||||
{
|
||||
if (p_device == &g_device)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (p_device == &g_device2)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
ONVIF_DEVICE * getDeviceByIndex(int index)
|
||||
{
|
||||
if (0 == index)
|
||||
{
|
||||
return &g_device;
|
||||
}
|
||||
else if (1 == index)
|
||||
{
|
||||
return &g_device2;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* onvif event notify callback
|
||||
*/
|
||||
void eventNotifyCallback(Notify_REQ * p_req, void * p_data)
|
||||
{
|
||||
NotificationMessageList * p_notify = p_req->notify;
|
||||
NotificationMessageList * p_tmp = p_notify;
|
||||
|
||||
printf("receive event : \r\n");
|
||||
printf("\tposturl : %s\r\n", p_req->PostUrl);
|
||||
|
||||
while (p_tmp)
|
||||
{
|
||||
printf("\tTopic : %s\r\n", p_tmp->NotificationMessage.Topic);
|
||||
|
||||
p_tmp = p_tmp->next;
|
||||
}
|
||||
|
||||
int index = -1;
|
||||
ONVIF_DEVICE * p_dev = NULL;
|
||||
|
||||
sscanf(p_req->PostUrl, "/subscription%d", &index);
|
||||
|
||||
p_dev = getDeviceByIndex(index);
|
||||
if (NULL == p_dev)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
onvif_device_add_NotificationMessages(p_dev, p_notify);
|
||||
|
||||
p_dev->events.notify_nums += onvif_get_NotificationMessages_nums(p_notify);
|
||||
|
||||
// max save 100 event notify
|
||||
if (p_dev->events.notify_nums > 100)
|
||||
{
|
||||
p_dev->events.notify_nums -= onvif_device_free_NotificationMessages(p_dev, p_dev->events.notify_nums - 100);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* onvif event subscribe disconnect callback
|
||||
*/
|
||||
void subscribeDisconnectCallback(ONVIF_DEVICE * p_dev, void * p_data)
|
||||
{
|
||||
printf("\r\nsubscribeDisconnectCallback, %s\r\n", p_dev->binfo.XAddr.host);
|
||||
|
||||
BOOL ret = FALSE;
|
||||
|
||||
ret = Subscribe(p_dev, getDeviceIndex(p_dev));
|
||||
|
||||
printf("Subscribe, ret = %d\r\n", ret);
|
||||
}
|
||||
|
||||
void errorHandler(ONVIF_DEVICE * p_device)
|
||||
{
|
||||
if (p_device->authFailed) // Authentication failed
|
||||
{
|
||||
printf("Authentication failed\r\n");
|
||||
}
|
||||
|
||||
switch (p_device->errCode)
|
||||
{
|
||||
case ONVIF_ERR_ConnFailure: // Connection failed
|
||||
printf("connect failure\r\n");
|
||||
break;
|
||||
|
||||
case ONVIF_ERR_MallocFailure: // Failed to allocate memory
|
||||
printf("memory malloc failure\r\n");
|
||||
break;
|
||||
|
||||
case ONVIF_ERR_NotSupportHttps: // The device requires an HTTPS connection, but the onvif client library does not support it (the HTTPS compilation macro is not enabled)
|
||||
printf("not support https\r\n");
|
||||
break;
|
||||
|
||||
case ONVIF_ERR_RecvTimeout: // Message receiving timeout
|
||||
printf("message receive timeout\r\n");
|
||||
break;
|
||||
|
||||
case ONVIF_ERR_InvalidContentType: // Device response message content is invalid
|
||||
printf("invalid content type\r\n");
|
||||
break;
|
||||
|
||||
case ONVIF_ERR_NullContent: // Device response message has no content
|
||||
printf("null content\r\n");
|
||||
break;
|
||||
|
||||
case ONVIF_ERR_ParseFailed: // Parsing the message failed
|
||||
printf("message parse failed\r\n");
|
||||
break;
|
||||
|
||||
case ONVIF_ERR_HandleFailed: // Message handling failed
|
||||
printf("message handle failed\r\n");
|
||||
break;
|
||||
|
||||
case ONVIF_ERR_HttpResponseError: // The device responded with an error message
|
||||
printf("code=%s\r\n", p_device->fault.Code);
|
||||
printf("subcode=%s\r\n", p_device->fault.Subcode);
|
||||
printf("reason=%s\r\n", p_device->fault.Reason);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
network_init();
|
||||
|
||||
// open log file
|
||||
log_init("onviftest2.log");
|
||||
log_set_level(HT_LOG_DBG);
|
||||
|
||||
// init sys buffer
|
||||
sys_buf_init(10 * MAX_DEV_NUMS);
|
||||
|
||||
// init http message buffer
|
||||
http_msg_buf_init(10 * MAX_DEV_NUMS);
|
||||
|
||||
// init event handler
|
||||
// bind the http server to 0.0.0.0:30100
|
||||
onvif_event_init(NULL, 30100, MAX_DEV_NUMS);
|
||||
|
||||
// set event callback
|
||||
onvif_set_event_notify_cb(eventNotifyCallback, 0);
|
||||
|
||||
// set event subscribe disconnect callback
|
||||
onvif_set_subscribe_disconnect_cb(subscribeDisconnectCallback, 0);
|
||||
|
||||
// init g_device
|
||||
memset(&g_device, 0, sizeof(g_device));
|
||||
|
||||
g_device.binfo.XAddr.https = 0;
|
||||
g_device.binfo.XAddr.port = 8000;
|
||||
strcpy(g_device.binfo.XAddr.host, "192.168.1.3");
|
||||
strcpy(g_device.binfo.XAddr.url, "/onvif/device_service");
|
||||
|
||||
// set device login information
|
||||
onvif_SetAuthInfo(&g_device, "admin", "admin");
|
||||
// set auth method
|
||||
onvif_SetAuthMethod(&g_device, AuthMethod_UsernameToken);
|
||||
// set request timeout
|
||||
onvif_SetReqTimeout(&g_device, 5000);
|
||||
|
||||
if (!GetSystemDateAndTime(&g_device))
|
||||
{
|
||||
errorHandler(&g_device);
|
||||
printf("%s, GetSystemDateAndTime failed\r\n", g_device.binfo.XAddr.host);
|
||||
}
|
||||
|
||||
if (!GetCapabilities(&g_device))
|
||||
{
|
||||
errorHandler(&g_device);
|
||||
printf("%s, GetCapabilities failed\r\n", g_device.binfo.XAddr.host);
|
||||
}
|
||||
|
||||
if (!GetServices(&g_device))
|
||||
{
|
||||
errorHandler(&g_device);
|
||||
printf("%s, GetServices failed\r\n", g_device.binfo.XAddr.host);
|
||||
}
|
||||
|
||||
if (!GetDeviceInformation(&g_device))
|
||||
{
|
||||
errorHandler(&g_device);
|
||||
printf("%s, GetDeviceInformation failed\r\n", g_device.binfo.XAddr.host);
|
||||
}
|
||||
|
||||
if (g_device.Capabilities.events.support == 1)
|
||||
{
|
||||
if (Subscribe(&g_device, getDeviceIndex(&g_device)))
|
||||
{
|
||||
printf("Subscribe successful!\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
errorHandler(&g_device);
|
||||
printf("Subscribe failed!\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
// init g_device2
|
||||
g_device2.binfo.XAddr.https = 0;
|
||||
g_device2.binfo.XAddr.port = 8000;
|
||||
strcpy(g_device2.binfo.XAddr.host, "192.168.1.4");
|
||||
strcpy(g_device2.binfo.XAddr.url, "/onvif/device_service");
|
||||
|
||||
// set device login information
|
||||
onvif_SetAuthInfo(&g_device2, "admin", "admin");
|
||||
// set auth method
|
||||
onvif_SetAuthMethod(&g_device2, AuthMethod_UsernameToken);
|
||||
// set request timeout
|
||||
onvif_SetReqTimeout(&g_device2, 5000);
|
||||
|
||||
if (!GetSystemDateAndTime(&g_device2))
|
||||
{
|
||||
errorHandler(&g_device2);
|
||||
printf("%s, GetSystemDateAndTime failed\r\n", g_device2.binfo.XAddr.host);
|
||||
}
|
||||
|
||||
if (!GetCapabilities(&g_device2))
|
||||
{
|
||||
errorHandler(&g_device2);
|
||||
printf("%s, GetCapabilities failed\r\n", g_device2.binfo.XAddr.host);
|
||||
}
|
||||
|
||||
if (!GetServices(&g_device2))
|
||||
{
|
||||
errorHandler(&g_device2);
|
||||
printf("%s, GetServices failed\r\n", g_device2.binfo.XAddr.host);
|
||||
}
|
||||
|
||||
if (!GetDeviceInformation(&g_device2))
|
||||
{
|
||||
errorHandler(&g_device2);
|
||||
printf("%s, GetDeviceInformation failed\r\n", g_device2.binfo.XAddr.host);
|
||||
}
|
||||
|
||||
if (g_device2.Capabilities.events.support == 1)
|
||||
{
|
||||
if (Subscribe(&g_device2, getDeviceIndex(&g_device2)))
|
||||
{
|
||||
printf("Subscribe successful!\r\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
errorHandler(&g_device2);
|
||||
printf("Subscribe failed!\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (getchar() == 'q')
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
onvif_free_device(&g_device);
|
||||
onvif_free_device(&g_device2);
|
||||
|
||||
onvif_event_deinit();
|
||||
|
||||
http_msg_buf_deinit();
|
||||
sys_buf_deinit();
|
||||
|
||||
log_close();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,202 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{DA689200-DC98-4BEF-A991-9AE67F89BA86}</ProjectGuid>
|
||||
<RootNamespace>OnvifTest2</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\bin\x86\</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\bin\x64\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\bin\x86\</OutDir>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\bin\x64\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(Platform)\$(ProjectName)\$(Configuration)\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectName)D</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(ProjectName)D</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;..\OnvifClientLibrary\bm;..\OnvifClientLibrary\http;..\OnvifClientLibrary\onvif;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>winmm.lib;OnvifClientLibrary.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)\$(ProjectName)D.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\lib\x86;..\OnvifClientLibrary\openssl\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;..\OnvifClientLibrary\bm;..\OnvifClientLibrary\http;..\OnvifClientLibrary\onvif;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>ws2_32.lib;OnvifClientLibrary.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)\$(ProjectName)D.exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\lib\x64;..\OnvifClientLibrary\openssl\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>.;..\OnvifClientLibrary\bm;..\OnvifClientLibrary\http;..\OnvifClientLibrary\onvif;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>winmm.lib;OnvifClientLibrary.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\lib\x86;..\OnvifClientLibrary\openssl\lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<AdditionalIncludeDirectories>.;..\OnvifClientLibrary\bm;..\OnvifClientLibrary\http;..\OnvifClientLibrary\onvif;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>OnvifClientLibrary.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)\$(ProjectName).exe</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\lib\x64;..\OnvifClientLibrary\openssl\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="OnvifTest2.cpp" />
|
||||
<ClCompile Include="stdafx.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="stdafx.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,60 @@
|
||||
################OPTION###################
|
||||
OUTPUT = onviftest2
|
||||
CCOMPILE = gcc
|
||||
CPPCOMPILE = g++
|
||||
COMPILEOPTION = -g -c -Wall
|
||||
COMPILEOPTION += -DIOS
|
||||
COMPILEOPTION += -DPROFILE_C_SUPPORT
|
||||
COMPILEOPTION += -DPROFILE_G_SUPPORT
|
||||
COMPILEOPTION += -DTHERMAL_SUPPORT
|
||||
COMPILEOPTION += -DCREDENTIAL_SUPPORT
|
||||
COMPILEOPTION += -DACCESS_RULES
|
||||
COMPILEOPTION += -DSCHEDULE_SUPPORT
|
||||
COMPILEOPTION += -DRECEIVER_SUPPORT
|
||||
COMPILEOPTION += -DIPFILTER_SUPPORT
|
||||
COMPILEOPTION += -DDEVICEIO_SUPPORT
|
||||
LINK = g++
|
||||
LINKOPTION = -g -o $(OUTPUT)
|
||||
INCLUDEDIR += -I../OnvifClientLibrary/bm
|
||||
INCLUDEDIR += -I../OnvifClientLibrary/http
|
||||
INCLUDEDIR += -I../OnvifClientLibrary/onvif
|
||||
LIBDIRS += -L../OnvifClientLibrary
|
||||
LIBDIRS += -L../OnvifClientLibrary/openssl/lib/linux
|
||||
OBJS = OnvifTest2.o
|
||||
SHAREDLIB += -lcrypto
|
||||
SHAREDLIB += -lssl
|
||||
SHAREDLIB += -lonvifclient
|
||||
SHAREDLIB += -lpthread
|
||||
APPENDLIB =
|
||||
|
||||
################OPTION END################
|
||||
|
||||
$(OUTPUT):$(OBJS) $(APPENDLIB)
|
||||
$(LINK) $(LINKOPTION) $(LIBDIRS) $(OBJS) $(SHAREDLIB) $(APPENDLIB)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
rm -f $(OUTPUT)
|
||||
all: clean $(OUTPUT)
|
||||
.PRECIOUS:%.cpp %.cc %.cxx %.c %.m %.mm
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .cpp .cc .cxx .c .m .mm .o
|
||||
|
||||
.cpp.o:
|
||||
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cpp
|
||||
|
||||
.cc.o:
|
||||
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cc
|
||||
|
||||
.cxx.o:
|
||||
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.cxx
|
||||
|
||||
.c.o:
|
||||
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.c
|
||||
|
||||
.m.o:
|
||||
$(CCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.m
|
||||
|
||||
.mm.o:
|
||||
$(CPPCOMPILE) -c -o $*.o $(COMPILEOPTION) $(INCLUDEDIR) $*.mm
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#! /bin/sh
|
||||
|
||||
CUR=$PWD
|
||||
export LD_LIBRARY_PATH=../OnvifClientLibrary:../OnvifClientLibrary/openssl/lib/linux
|
||||
./onviftest2
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <ws2tcpip.h>
|
||||
#include <ws2ipdef.h>
|
||||
#include <winsock2.h>
|
||||
#include <mmsystem.h>
|
||||
|
||||
#include <io.h>
|
||||
#include <iphlpapi.h>
|
||||
#include <vfw.h>
|
||||
|
||||
#include <tchar.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user