차이
문서의 선택한 두 판 사이의 차이를 보여줍니다.
| 다음 판 | 이전 판 | ||
|
ko:bs2_setrtspconfig [2022/08/24 19:40] kkshin 만듦 |
ko:bs2_setrtspconfig [2024/05/28 19:04] (현재) kkshin |
||
|---|---|---|---|
| 줄 5: | 줄 5: | ||
| ===== BS2_SetRtspConfig ===== | ===== BS2_SetRtspConfig ===== | ||
| - | [+ 2.8.3] ''BioStation 3'' RTSP 설정을 저장합니다. | + | [+ 2.8.3] RTSP 설정을 저장합니다. |
| ==== 함수 ==== | ==== 함수 ==== | ||
| <code cpp> | <code cpp> | ||
| 줄 22: | 줄 22: | ||
| ==== 반환값 ==== | ==== 반환값 ==== | ||
| 성공적으로 수행될 경우 ''BS_SDK_SUCCESS''를 반환하고, 에러가 발생할 경우 상응하는 에러 코드를 반환합니다. | 성공적으로 수행될 경우 ''BS_SDK_SUCCESS''를 반환하고, 에러가 발생할 경우 상응하는 에러 코드를 반환합니다. | ||
| - | ==== 샘플코드 ==== | + | ==== 샘플코드(C++) ==== |
| - | C++ | + | <file cpp sample_setrtspconfig.cpp> |
| - | <code cpp> | + | BS2RtspConfig config = { 0, }; |
| - | BS2RtspConfig config = { 0, }; | + | |
| - | config.enabled = true; | + | config.enabled = true; |
| - | string acc = "myAccount"; | + | string acc = "myAccount"; |
| - | memset(config.id, 0x0, BS2_USER_ID_SIZE); | + | memset(config.id, 0x0, BS2_USER_ID_SIZE); |
| - | memcpy(config.id, acc.c_str(), acc.size()); | + | memcpy(config.id, acc.c_str(), acc.size()); |
| - | string pw = "myPassword"; | + | string pw = "myPassword"; |
| - | memset(config.password, 0x0, BS2_USER_ID_SIZE); | + | memset(config.password, 0x0, BS2_USER_ID_SIZE); |
| - | memcpy(config.password, pw.c_str(), pw.size()); | + | memcpy(config.password, pw.c_str(), pw.size()); |
| - | string addr = "192.168.0.10"; // rtsp://192.168.0.10 | + | string addr = "192.168.0.10"; // rtsp://192.168.0.10 |
| - | memset(config.address, 0x0, BS2_URL_SIZE); | + | memset(config.address, 0x0, BS2_URL_SIZE); |
| - | memcpy(config.address, addr.c_str(), addr.size()); | + | memcpy(config.address, addr.c_str(), addr.size()); |
| - | config.port = 554; | + | config.port = 554; |
| - | int sdkResult = BS2_SetRtspConfig(context, deviceID, &config); | + | int sdkResult = BS2_SetRtspConfig(context, deviceID, &config); |
| - | if (BS_SDK_SUCCESS != sdkResult) | + | if (BS_SDK_SUCCESS != sdkResult) |
| - | printf("BS2_SetRtspConfig call failed: %d", sdkResult); | + | printf("BS2_SetRtspConfig call failed: %d", sdkResult); |
| - | </code> | + | </file> |
| - | C# | + | ==== 샘플코드(C#) ==== |
| - | <code cpp> | + | <file csharp sample_setrtspconfig.cs> |
| - | BS2RtspConfig config = Util.AllocateStructure<BS2RtspConfig>(); | + | BS2RtspConfig config = Util.AllocateStructure<BS2RtspConfig>(); |
| - | config.enabled = Convert.ToByte(1); | + | config.enabled = Convert.ToByte(1); |
| - | string strRTSPID = "myAccount"; | + | string strRTSPID = "myAccount"; |
| - | byte[] arrRTSPID = Encoding.UTF8.GetBytes(strRTSPID); | + | byte[] arrRTSPID = Encoding.UTF8.GetBytes(strRTSPID); |
| - | Array.Clear(config.id, 0, BS2Environment.BS2_USER_ID_SIZE); | + | Array.Clear(config.id, 0, BS2Environment.BS2_USER_ID_SIZE); |
| - | Array.Copy(arrRTSPID, 0, config.id, 0, arrRTSPID.Length); | + | Array.Copy(arrRTSPID, 0, config.id, 0, arrRTSPID.Length); |
| - | string strRTSPPW = "myPassword"; | + | string strRTSPPW = "myPassword"; |
| - | byte[] arrRTSPPW = Encoding.UTF8.GetBytes(strRTSPPW); | + | byte[] arrRTSPPW = Encoding.UTF8.GetBytes(strRTSPPW); |
| - | Array.Clear(config.password, 0, BS2Environment.BS2_USER_ID_SIZE); | + | Array.Clear(config.password, 0, BS2Environment.BS2_USER_ID_SIZE); |
| - | Array.Copy(arrRTSPPW, 0, config.password, 0, arrRTSPPW.Length); | + | Array.Copy(arrRTSPPW, 0, config.password, 0, arrRTSPPW.Length); |
| - | string strIpAddr = "192.168.0.10"; // rtsp://192.168.0.10 | + | string strIpAddr = "192.168.0.10"; // rtsp://192.168.0.10 |
| - | byte[] arrIpAddr = Encoding.UTF8.GetBytes(strIpAddr); | + | byte[] arrIpAddr = Encoding.UTF8.GetBytes(strIpAddr); |
| - | Array.Clear(config.address, 0, BS2Environment.BS2_URL_SIZE); | + | Array.Clear(config.address, 0, BS2Environment.BS2_URL_SIZE); |
| - | Array.Copy(arrIpAddr, 0, config.address, 0, arrIpAddr.Length); | + | Array.Copy(arrIpAddr, 0, config.address, 0, arrIpAddr.Length); |
| - | config.port = (ushort)554; | + | config.port = (ushort)554; |
| - | BS2ErrorCode result = (BS2ErrorCode)API.BS2_SetRtspConfig(sdkContext, deviceID, ref config); | + | BS2ErrorCode result = (BS2ErrorCode)API.BS2_SetRtspConfig(sdkContext, deviceID, ref config); |
| - | if (result != BS2ErrorCode.BS_SDK_SUCCESS) | + | if (result != BS2ErrorCode.BS_SDK_SUCCESS) |
| - | { | + | { |
| - | Console.WriteLine("Got error({0}).", result); | + | Console.WriteLine("Got error({0}).", result); |
| - | } | + | } |
| - | </code> | + | </file> |