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.

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