C++ digest authentication, digest 인증, 사용자 인증
카메라제어방법은 SUNAPI1.0 문서를 참고하면 된다.
아래 예시는 카메라의 PTZ(Pan, Tilt, Zoom)를 제어하는 방법이다.
#include "stdafx.h"
#using <System.dll>
using namespace System;
using namespace System::Net;
using namespace System::Text;
using namespace System::IO;
int _tmain(int argc, _TCHAR* argv[])
{
array<String^>^args = Environment::GetCommandLineArgs();
HttpWebRequest^ request = dynamic_cast<HttpWebRequest^>(WebRequest::Create(URL));
// URL : "http://192.168.0.4/cgi-bin/ptz.cgi?move=absmove&pan=50&tilt=90&zoom=5"
// Set some reasonable limits on resources used by this request
request->MaximumAutomaticRedirections = 4;
request->MaximumResponseHeadersLength = 4;
// Set credentials to use for this request.
request->Credentials = gcnew NetworkCredential(User ID, PASSWORD);
HttpWebResponse^ response = dynamic_cast<HttpWebResponse^>(request->GetResponse());
Console::WriteLine( "Content length is {0}", response->ContentLength );
Console::WriteLine( "Content type is {0}", response->ContentType );
// Get the stream associated with the response.
Stream^ receiveStream = response->GetResponseStream();
// Pipes the stream to a higher level stream reader with the required encoding format.
StreamReader^ readStream = gcnew StreamReader( receiveStream,Encoding::UTF8 );
Console::WriteLine( "Response stream received." );
Console::WriteLine( readStream->ReadToEnd() );
response->Close();
readStream->Close();
return 0;
}
'과거자료 > SUNAPI 1.0' 카테고리의 다른 글
[SUNAPI 1.0] 사용자인증 digest 인증방법 (1) | 2014.02.28 |
---|