You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

528 lines
15 KiB

7 years ago
​
​
​
​
​
7 years ago
7 years ago
7 years ago
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
7 years ago
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
7 years ago
​
​
​
​
​
7 years ago
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
7 years ago
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
7 years ago
7 years ago
​
7 years ago
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
7 years ago
​
​
  1. #include "protocolPTZ_PELCO.h"
  2. #include "../../hardware/uart/serialPort.h"
  3. #define LOG( X ) m_pLog->Log( "Proto[PELCO]", this, X )
  4. #define LOG_ERROR( X ) m_pLog->Log( "Proto[PELCO]", this, _LOG_ERROR, X )
  5. protocolPTZ_PELCO::protocolPTZ_PELCO(config_setting_t *Settings): protocolPTZ(), m_mInquiryMutex(){
  6. m_pLog = basicLogCollection::getInstance();
  7. m_pSettings = Settings;
  8. m_bReplyRequired = false;
  9. m_bDPlusEna = false;
  10. m_bCAM_ID = 1;
  11. m_bLastCommandIssued = CMD_PTZ_NOOP;
  12. };
  13. protocolPTZ_PELCO::protocolPTZ_PELCO( uint8_t CAM_ID ): protocolPTZ(), m_mInquiryMutex(){
  14. m_pLog = basicLogCollection::getInstance();
  15. m_pSettings = NULL;
  16. m_bReplyRequired = false;
  17. m_bDPlusEna = false;
  18. m_bCAM_ID = CAM_ID;
  19. m_bLastCommandIssued = CMD_PTZ_NOOP;
  20. };
  21. protocolPTZ_PELCO::~protocolPTZ_PELCO(){
  22. };
  23. U8 protocolPTZ_PELCO::finishUpPackage(U8 *pBuffer){
  24. U8 nChecksum = 0;
  25. pBuffer[SYNC_IDX] = 0xFF;
  26. pBuffer[ADR_IDX] = m_bCAM_ID;
  27. for (U8 i = ADR_IDX; i < CHKSUM_IDX; i++) nChecksum += pBuffer[i];
  28. pBuffer[CHKSUM_IDX] = nChecksum;
  29. return 7;
  30. };
  31. int protocolPTZ_PELCO::packetChecker(U8* Buffer, size_t BufferSize) {
  32. if( Buffer[0] == 0xFF ) {
  33. if( BufferSize > 1 ){
  34. if( Buffer[1] == 0x00 || Buffer[1] == m_bCAM_ID ) {
  35. U8 tChSumm;
  36. // Check 4 Bytes Responce
  37. if( BufferSize > 3 ){
  38. tChSumm = 0;
  39. for (U8 i = 1; i< 4; i++) tChSumm += Buffer[i];
  40. if (Buffer[4] == tChSumm){
  41. #ifdef DEBUG
  42. LOG("PacketChecker: 4 Byte Packet Is Recognized");
  43. #endif
  44. return 0;
  45. };
  46. };
  47. // Check 7 Bytes Responce
  48. if( BufferSize > 6 ){
  49. U8 tChSumm = 0;
  50. for( U8 i=1; i< 6; i++ ) tChSumm += Buffer[ i ];
  51. if( Buffer[6] == tChSumm ){
  52. #ifdef DEBUG
  53. LOG("PacketChecker: 7 Byte Packet Is Recognized");
  54. #endif
  55. return 0;
  56. };
  57. };
  58. // Check 18 Bytes Responce
  59. if (BufferSize > 17){
  60. U8 tChSumm = 0;
  61. for( U8 i = 1; i< 17; i++ ) tChSumm += Buffer[i];
  62. if( Buffer[17] == tChSumm ){
  63. #ifdef DEBUG
  64. LOG("PacketChecker: 18 Byte Packet Is Recognized");
  65. #endif
  66. return 0;
  67. };
  68. };
  69. } else return -1;
  70. };
  71. return 1;
  72. };
  73. #ifdef DEBUG
  74. LOG("PacketChecker: Packet Not Recognized");
  75. #endif
  76. return -1;
  77. };
  78. protocolPackage *protocolPTZ_PELCO::packetExtractor(unsigned char *Buffer, size_t BufferSize){
  79. protocolPackage *RetVal;
  80. if( BufferSize < 4 ) return NULL;
  81. RetVal = (protocolPackage*)malloc(sizeof(protocolPackage));
  82. if( RetVal != NULL ){
  83. RetVal->m_pData = (U8*) malloc(18);
  84. if (RetVal->m_pData != NULL){
  85. U8 tChSumm = 0;
  86. U8 i;
  87. RetVal->m_pData[tChSumm] = Buffer[tChSumm];
  88. for (i = 1; i < 18; i++){
  89. tChSumm += RetVal->m_pData[i] = Buffer[i];
  90. if ((i == 17 || i == 6 || i == 3) && (Buffer[i] == tChSumm)){
  91. RetVal->m_nSize = i + 1;
  92. return RetVal;
  93. };
  94. };
  95. free(RetVal->m_pData);
  96. };
  97. free(RetVal);
  98. };
  99. return NULL;
  100. };
  101. bool protocolPTZ_PELCO::packetHandler(protocolPackage *Package){
  102. U8 Com_Mode;
  103. U8 Cat_Code;
  104. LOG( "PacketHandler: Packet Is Handling");
  105. Com_Mode = Package->m_pData[1];
  106. Cat_Code = Package->m_pData[2];
  107. m_bLastCommandIssued = CMD_PTZ_NOOP;
  108. free( Package->m_pData );
  109. free( Package );
  110. return true;
  111. };
  112. bool protocolPTZ_PELCO::create( void ){
  113. config_setting_t *pSetting;
  114. int tPort, tSpeed;
  115. if (!protocolPTZ::create()) {
  116. LOG("basic Failed!");
  117. return false;
  118. };
  119. m_bStatus = 0;
  120. if( m_pSettings != NULL ) {
  121. pSetting = config_setting_get_member(m_pSettings, PPTZ_TAG_COM_PORT);
  122. if (pSetting == NULL) return false;
  123. tPort = config_setting_get_int(pSetting);
  124. pSetting = config_setting_get_member(m_pSettings, PPTZ_TAG_COM_SPEED);
  125. if (pSetting == NULL) return false;
  126. tSpeed = config_setting_get_int(pSetting);
  127. pSetting = config_setting_get_member(m_pSettings, PPTZ_TAG_CAM_ID);
  128. if (pSetting == NULL) return false;
  129. m_bCAM_ID = (U8)config_setting_get_int(pSetting);
  130. pSetting = config_setting_get_member(m_pSettings, PELCO_D_PLUS_ENABLE);
  131. if (pSetting != NULL) {
  132. m_bDPlusEna = (bool)config_setting_get_bool(pSetting);
  133. };
  134. char tBuf[16];
  135. #ifdef __linux__
  136. sprintf( tBuf,"/dev/ttyS%d",tPort);
  137. #else
  138. sprintf(tBuf, "com%d", tPort);
  139. #endif
  140. m_oDataTransport = new serialPort(tBuf,tSpeed);
  141. if (m_oDataTransport != NULL){
  142. if (m_oDataTransport->addRecipient(this)){
  143. setConnectionStatus(CS_CONNECTED);
  144. m_bStatus = 1;
  145. return true;
  146. };
  147. };
  148. };
  149. if( m_oDataTransport!= NULL ) {
  150. m_bStatus = 1;
  151. return true;
  152. } else LOG_ERROR("Transport Not Assigned!");
  153. return false;
  154. };
  155. bool protocolPTZ_PELCO::initCamera(void){
  156. return setPowerSaveMode( false );
  157. };
  158. bool protocolPTZ_PELCO::setPowerSaveMode( bool nMode ){
  159. U8 Buffer[8];
  160. if (m_bStatus == 0) return false;
  161. //if (m_bReplyRequired) if (m_bLastCommandIssued != CMD_PTZ_NOOP) return false;
  162. m_bPowerSave_Mode = !nMode;
  163. m_bLastCommandIssued =( m_bPowerSave_Mode )?CMD_PTZ_POWER_ON:CMD_PTZ_POWER_OFF;
  164. memset(Buffer, 0, 8);
  165. Buffer[DCMD1_IDX] = (m_bPowerSave_Mode) ? 0x88 : 0x08;
  166. LOG("Sending POWER ON/OFF");
  167. return m_oDataTransport->sendData(Buffer, finishUpPackage(Buffer));
  168. };
  169. bool protocolPTZ_PELCO::getPowerSaveMode( void ){
  170. U8 Buffer[16];
  171. if (m_bStatus == 0) return false;
  172. //if (m_bReplyRequired) if (m_bLastCommandIssued != CMD_PTZ_NOOP) return false;
  173. Buffer[0] = 0x80 + m_bCAM_ID;
  174. Buffer[1]=0x09;
  175. Buffer[2]=0x04;
  176. Buffer[3]=0x00;
  177. Buffer[4]=0xFF;
  178. m_mInquiryMutex.lock();
  179. LOG("Ask POWER mode");
  180. m_oDataTransport->sendData( Buffer, 5 );
  181. m_mInquiryMutex.lock();
  182. m_mInquiryMutex.unlock();
  183. LOG("Ask POWER mode -> Done");
  184. return m_bPowerSave_Mode;
  185. };
  186. bool protocolPTZ_PELCO::startZoomWide( void ){
  187. U8 Buffer[16];
  188. if (m_bStatus == 0) return false;
  189. //if (m_bReplyRequired) if (m_bLastCommandIssued != CMD_PTZ_NOOP) return false;
  190. Buffer[0] = 0x80 + m_bCAM_ID;
  191. Buffer[1]=0x01;
  192. Buffer[2]=0x04;
  193. Buffer[3]=0x07;
  194. Buffer[4]=0x03;
  195. Buffer[5]=0xFF;
  196. LOG("Start Zoom Wide(standard)");
  197. m_oDataTransport->sendData( Buffer, 6 );
  198. return true;
  199. };
  200. bool protocolPTZ_PELCO::startZoomTele( void ){
  201. U8 Buffer[16];
  202. if (m_bStatus == 0) return false;
  203. //if (m_bReplyRequired) if (m_bLastCommandIssued != CMD_PTZ_NOOP) return false;
  204. Buffer[0] = 0x80 + m_bCAM_ID;
  205. Buffer[1]=0x01;
  206. Buffer[2]=0x04;
  207. Buffer[3]=0x07;
  208. Buffer[4]=0x02;
  209. Buffer[5]=0xFF;
  210. LOG("Start Zoom Tele(standard)");
  211. m_oDataTransport->sendData( Buffer, 6 );
  212. return true;
  213. };
  214. bool protocolPTZ_PELCO::startZoomWide( double nSpeed ){
  215. U8 Buffer[16];
  216. if (m_bStatus == 0) return false;
  217. //if (m_bReplyRequired) if (m_bLastCommandIssued != CMD_PTZ_NOOP) return false;
  218. Buffer[0] = 0x80 + m_bCAM_ID;
  219. Buffer[1]=0x01;
  220. Buffer[2]=0x04;
  221. Buffer[3]=0x07;
  222. U8 Param;
  223. Param = ((U8)( 2 + nSpeed * 5 )) & 0x07;
  224. Buffer[4]=0x30 | Param;
  225. Buffer[5]=0xFF;
  226. LOG("Start Zoom Wide(parameter)");
  227. m_oDataTransport->sendData( Buffer, 6 );
  228. return true;
  229. };
  230. bool protocolPTZ_PELCO::startZoomTele( double nSpeed ){
  231. U8 Buffer[16];
  232. if (m_bStatus == 0) return false;
  233. //if (m_bReplyRequired) if (m_bLastCommandIssued != CMD_PTZ_NOOP) return false;
  234. Buffer[0] = 0x80 + m_bCAM_ID;
  235. Buffer[1]=0x01;
  236. Buffer[2]=0x04;
  237. Buffer[3]=0x07;
  238. U8 Param;
  239. Param = ((U8)( 2 + nSpeed * 5 )) & 0x07;
  240. Buffer[4]=0x20 | Param;
  241. Buffer[5]=0xFF;
  242. LOG("Start Zoom Tele(parameter)");
  243. m_oDataTransport->sendData( Buffer, 6 );
  244. return true;
  245. };
  246. bool protocolPTZ_PELCO::stopZoom( void ){
  247. U8 Buffer[16];
  248. if (m_bStatus == 0) return false;
  249. //if (m_bReplyRequired) if (m_bLastCommandIssued != CMD_PTZ_NOOP) return false;
  250. Buffer[0] = 0x80 + m_bCAM_ID;
  251. Buffer[1]=0x01;
  252. Buffer[2]=0x04;
  253. Buffer[3]=0x07;
  254. Buffer[4]=0x00;
  255. Buffer[5]=0xFF;
  256. LOG("Stop Zoom");
  257. m_oDataTransport->sendData( Buffer, 6 );
  258. return true;
  259. };
  260. /*double protocolPTZ_PELCO::getZoom( void ){
  261. U8 Buffer[16];
  262. if (m_bStatus == 0) return false;
  263. if (m_bReplyRequired) if (m_bLastCommandIssued != CMD_PTZ_NOOP) return false;
  264. Buffer[0] = 0x80 + m_bCAM_ID;
  265. Buffer[1]=0x09;
  266. Buffer[2]=0x04;
  267. Buffer[3]=0x47;
  268. Buffer[4]=0xFF;
  269. m_mInquiryMutex.lock();
  270. LOG("Ask Zoom");
  271. m_oDataTransport->sendData( Buffer, 5 );
  272. m_mInquiryMutex.lock();
  273. m_mInquiryMutex.unlock();
  274. LOG("Ask Zoom -> Done");
  275. return m_dZoom;
  276. };
  277. */
  278. bool protocolPTZ_PELCO::resetPTZDrive( void ){
  279. U8 Buffer[16];
  280. if (m_bStatus == 0) return false;
  281. memset(Buffer, 0, 16);
  282. Buffer[DCMD1_IDX] = 0x00;
  283. Buffer[DCMD2_IDX] = 0x0F;
  284. Buffer[DATA1_IDX] = 0x00;
  285. Buffer[DATA2_IDX] = 0x00;
  286. LOG("Reset PTZ");
  287. return m_oDataTransport->sendData(Buffer, finishUpPackage(Buffer));
  288. };
  289. bool protocolPTZ_PELCO::goHomePosition( void ){
  290. U8 Buffer[8];
  291. if (m_bStatus == 0) return false;
  292. memset(Buffer, 0, 8);
  293. Buffer[DCMD2_IDX] = 0x07;
  294. Buffer[DATA2_IDX] = 0x22;
  295. LOG("Go Home");
  296. return m_oDataTransport->sendData(Buffer, finishUpPackage(Buffer));
  297. };
  298. bool protocolPTZ_PELCO::setPanPos( double dPan ){
  299. uint8_t Buffer[16];
  300. uint16_t SPan;
  301. // -1 == 0 deg ... 1 = 360 deg
  302. SPan = (( uint16_t )( 18000.0 + 18000.0 * dPan ) ) % 36000;
  303. memset(Buffer, 0, 16);
  304. Buffer[DCMD2_IDX] = 0x4B;
  305. Buffer[DATA1_IDX] = ( SPan >> 8 ) & 0xFF;
  306. Buffer[DATA2_IDX] = SPan & 0xFF;
  307. #ifdef DEBUG
  308. char tBuffer[64];
  309. sprintf(tBuffer, "setPanPos %.3f", dPan );
  310. LOG(tBuffer);
  311. #endif
  312. return m_oDataTransport->sendData(Buffer, finishUpPackage(Buffer));
  313. };
  314. bool protocolPTZ_PELCO::setTiltPos( double dTilt ){
  315. uint8_t Buffer[16];
  316. uint16_t STlt;
  317. //STlt = ((U16)(18000.0 + 18000.0 * ((dTilt + 1.f) / 2.f))) % 18000;
  318. STlt = (( uint16_t )( 18000.0 + 18000.0 * dTilt ) ) % 18000;
  319. memset(Buffer, 0, 16);
  320. Buffer[DCMD2_IDX] = 0x4D;
  321. Buffer[DATA1_IDX] = ( STlt >> 8 ) & 0xFF;
  322. Buffer[DATA2_IDX] = STlt & 0xFF;
  323. #ifdef DEBUG
  324. char tBuffer[64];
  325. sprintf(tBuffer, "setTiltPos %.3f -> %d", dTilt, STlt);
  326. LOG(tBuffer);
  327. #endif
  328. return m_oDataTransport->sendData(Buffer, finishUpPackage(Buffer));
  329. };
  330. bool protocolPTZ_PELCO::setZoom( double dZoom ){
  331. U8 Buffer[16];
  332. U16 SZum;
  333. SZum = (U16)(65535 * dZoom );
  334. memset(Buffer, 0, 16);
  335. Buffer[DCMD2_IDX] = 0x4F;
  336. Buffer[DATA1_IDX] = ( SZum >> 8 ) & 0xFF;
  337. Buffer[DATA2_IDX] = SZum & 0xFF;
  338. #ifdef DEBUG
  339. char tBuffer[64];
  340. sprintf(tBuffer, "setZoomPos %.3f", dZoom);
  341. LOG(tBuffer);
  342. #endif
  343. return m_oDataTransport->sendData(Buffer, finishUpPackage(Buffer));
  344. };
  345. bool protocolPTZ_PELCO::move(uint32_t MoveMatrix){
  346. U8 Buffer[16];
  347. U8 Param1, Param2;
  348. if (m_bStatus == 0) return false;
  349. // if (m_bReplyRequired) if (m_bLastCommandIssued != CMD_PTZ_NOOP) return false;
  350. Param1 = (U8)(m_dPanSpeed * 64.0) & 0xFF;
  351. Param2 = (U8)(m_dTiltSpeed * 64.0) & 0xFF;
  352. memset(Buffer, 0, 16);
  353. if ((MoveMatrix & PTZ_DRIVE_PAN_MASK) != 0){
  354. if ((MoveMatrix & PTZ_DRIVE_PAN_LEFT) != 0){
  355. Buffer[DCMD2_IDX] |= 0x04;
  356. } else {
  357. Buffer[DCMD2_IDX] |= 0x02;
  358. };
  359. };
  360. if ((MoveMatrix & PTZ_DRIVE_TILT_MASK) != 0){
  361. if ((MoveMatrix & PTZ_DRIVE_TILT_UP) != 0){
  362. Buffer[DCMD2_IDX] |= 0x08;
  363. } else {
  364. Buffer[DCMD2_IDX] |= 0x10;
  365. };
  366. };
  367. if ((MoveMatrix & PTZ_DRIVE_ZOOM_MASK) != 0){
  368. if ((MoveMatrix & PTZ_DRIVE_ZOOM_WIDE) != 0){
  369. Buffer[DCMD2_IDX] |= 0x40;
  370. } else {
  371. Buffer[DCMD2_IDX] |= 0x20;
  372. };
  373. };
  374. Buffer[DATA1_IDX] = Param1; // Max = 3f Turbo Pan = FF
  375. Buffer[DATA2_IDX] = Param2;
  376. LOG("Make move");
  377. bool tv = m_oDataTransport->sendData(Buffer, finishUpPackage(Buffer));
  378. if( tv ) SLEEP(500);
  379. return tv;
  380. };
  381. bool protocolPTZ_PELCO::goAbsolute( float dPan, float dTilt, float dZoom) {
  382. if( m_bStatus == 0 ) return false;
  383. // if (m_bReplyRequired) if (m_bLastCommandIssued != CMD_PTZ_NOOP) return false;
  384. if( m_bDPlusEna ) {
  385. U8 Buffer[16];
  386. U8 Param1, Param2;
  387. memset(Buffer, 0, 16 );
  388. Buffer[0] = 0x80 + m_bCAM_ID;
  389. Buffer[1] = 0x01;
  390. Buffer[2] = 0x06;
  391. Buffer[3] = 0x02;
  392. Buffer[4] = 0x18;//Max Pan Speed
  393. Buffer[5] = 0x14;//Max Tilt Speed
  394. uint16_t pPos, tPos;
  395. //-880 .. 880
  396. pPos = (uint16_t)(880.0 * dPan);
  397. Buffer[6] = 0x0F & (pPos >> 12);
  398. Buffer[7] = 0x0F & (pPos >> 8);
  399. Buffer[8] = 0x0F & (pPos >> 4);
  400. Buffer[9] = 0x0F & pPos;
  401. //-300 .. 300
  402. tPos = (uint16_t)(300.0 * dTilt);
  403. Buffer[10] = 0x0F & (tPos >> 12);
  404. Buffer[11] = 0x0F & (tPos >> 8);
  405. Buffer[12] = 0x0F & (tPos >> 4);
  406. Buffer[13] = 0x0F & tPos;
  407. Buffer[14] = 0xFF;
  408. LOG("ABS move");
  409. bool tv = m_oDataTransport->sendData(Buffer, 15);
  410. if( tv ) SLEEP(500);
  411. return tv;
  412. } else {
  413. LOG("ABS move");
  414. if( setPanPos( dPan ) ){
  415. SLEEP( 500 );
  416. if( setTiltPos(dTilt) ){
  417. SLEEP( 500 );
  418. if( setZoom(dZoom)){
  419. SLEEP( 500 );
  420. return true;
  421. };
  422. };
  423. };
  424. };
  425. return false;
  426. };
  427. bool protocolPTZ_PELCO::setAutoFocus(bool nMode){
  428. m_bAutoFocus_Mode = nMode;
  429. U8 Buffer[8];
  430. if (m_bStatus == 0) return false;
  431. memset(Buffer, 0, 8);
  432. Buffer[DCMD2_IDX] = 0x2B;
  433. Buffer[DATA2_IDX] = (m_bAutoFocus_Mode) ? 0x01 : 0x02;
  434. LOG("setAutoFocus");
  435. return m_oDataTransport->sendData(Buffer, finishUpPackage(Buffer));
  436. };
  437. bool protocolPTZ_PELCO::setOSD( bool nMode ){
  438. U8 Buffer[16];
  439. if (m_bStatus == 0) return false;
  440. //if (m_bReplyRequired) if (m_bLastCommandIssued != CMD_PTZ_NOOP) return false;
  441. Buffer[0] = 0x80 + m_bCAM_ID;
  442. Buffer[1]=0x01;
  443. Buffer[2]=0x06;
  444. Buffer[3]=0x06;
  445. Buffer[4]=(nMode)?0x02:0x03;
  446. Buffer[5]=0xFF;
  447. LOG("Set On Screen Display mode");
  448. m_oDataTransport->sendData( Buffer, 6 );
  449. return true;
  450. };
  451. /*
  452. bool protocolPTZ_PELCO::setPSpeed(double Speed) {
  453. m_dPanSpeed = Speed;
  454. LOG("setPanSpeed");
  455. return move(0);
  456. };
  457. bool protocolPTZ_PELCO::setTSpeed(double Speed) {
  458. m_dTiltSpeed = Speed;
  459. LOG("setTiltSpeed");
  460. return move(0);
  461. };
  462. bool protocolPTZ_PELCO::setPTZSpeed(double pSpeed, double tSpeed, double zSpeed) {
  463. m_dPanSpeed = pSpeed;
  464. m_dTiltSpeed = tSpeed;
  465. m_dZoomSpeed = zSpeed;
  466. LOG("setPTZSpeed");
  467. return move(0);
  468. };
  469. bool protocolPTZ_PELCO::setZSpeed(double Speed) {
  470. m_dZoomSpeed = Speed;
  471. U8 Buffer[8];
  472. if (m_bStatus == 0) return false;
  473. memset(Buffer, 0, 8);
  474. Buffer[DCMD2_IDX] = 0x25;
  475. U8 sValue = (U8)floor(m_dZoomSpeed * 3.f);
  476. Buffer[DATA2_IDX] = sValue;
  477. LOG("setZoomSpeed");
  478. return m_oDataTransport->sendData(Buffer, finishUpPackage(Buffer));
  479. };
  480. bool protocolPTZ_PELCO::setFSpeed(double Speed) {
  481. m_dZoomSpeed = Speed;
  482. U8 Buffer[8];
  483. if (m_bStatus == 0) return false;
  484. memset(Buffer, 0, 8);
  485. Buffer[DCMD2_IDX] = 0x27;
  486. U8 sValue = (U8)floor( m_dZoomSpeed * 3.f );
  487. Buffer[DATA2_IDX] = sValue;
  488. LOG("setFocusSpeed");
  489. return m_oDataTransport->sendData(Buffer, finishUpPackage(Buffer));
  490. };
  491. */
  492. #undef LOG
  493. #undef LOG_ERROR