ETC.txt.cpp 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. m_pHTTP = new TIdHTTP(this);
  2. m_pHTTP->ConnectTimeout = 30000;
  3. m_pHTTP->Request->BasicAuthentication = true;
  4. m_lCCTV = 0;
  5. String sStreamIP;
  6. if (m_pHTTP->Connected()) m_pHTTP->Disconnect();
  7. try{
  8. teCCTVID->Text = cxGTV1->DataController->Values[cxGTV1->DataController->FocusedRecordIndex][1];
  9. teLocation->Text = cxGTV1->DataController->Values[cxGTV1->DataController->FocusedRecordIndex][2];
  10. teNo->Text = cxGTV1->DataController->Values[cxGTV1->DataController->FocusedRecordIndex][0];
  11. btLock->Hint = cxGTV1->DataController->Values[cxGTV1->DataController->FocusedRecordIndex][5];
  12. AnsiString sStr = cxGTV1->DataController->Values[cxGTV1->DataController->FocusedRecordIndex][3];
  13. edCtrl->Text = cxGTV1->DataController->Values[cxGTV1->DataController->FocusedRecordIndex][5];
  14. edCommStatus->Text= cxGTV1->DataController->Values[cxGTV1->DataController->FocusedRecordIndex][4];
  15. sStreamIP = pCCTVList->Items[cxGTV1->DataController->FocusedRecordIndex]->StreamIP;
  16. edRow->Text = IntToStr(cxGTV1->DataController->FocusedRecordIndex);
  17. teWeb->Text = cxGTV1->DataController->Values[cxGTV1->DataController->FocusedRecordIndex][7];
  18. if (teWeb->Text == "1") {
  19. Panel1->Visible = false;
  20. Panel2->Visible = true;
  21. SpeedButton9->Enabled = false;
  22. SpeedButton14->Enabled = false;
  23. m_pHTTP->Request->Username = "admin";
  24. m_pHTTP->Request->Password = "admin";
  25. } else if (teWeb->Text == "2") {
  26. Panel1->Visible = false;
  27. Panel2->Visible = true;
  28. SpeedButton9->Enabled = true;
  29. SpeedButton14->Enabled = true;
  30. m_pHTTP->Request->Username = "Admin";
  31. m_pHTTP->Request->Password = "1234";
  32. } else {
  33. Panel1->Visible = true;
  34. Panel2->Visible = false;
  35. }
  36. AnsiString sStr1 = "rtsp://" + sStreamIP + "/" + sStr;
  37. if(AX != NULL){
  38. delete AX;
  39. AX = NULL;
  40. m_lCCTV = 0;
  41. }
  42. AX = new TAcesTechXPlayer2(this);
  43. AX->URL = sStr1;
  44. AX->Parent = Panel8;
  45. AX->Align = alClient;
  46. m_lCCTV = AX->Connect();
  47. }catch(...){
  48. if(AX != NULL){
  49. delete AX;
  50. AX = NULL;
  51. m_lCCTV= 0;
  52. }
  53. MessageDlg("CCTV가 표출 가능한 상태가 아닙니다.", mtConfirmation, TMsgDlgButtons() << mbOK, 0);
  54. }
  55. void __fastcall TCCTVCtrlF::SpeedButton10MouseDown(TObject *Sender, TMouseButton Button,
  56. TShiftState Shift, int X, int Y)
  57. {
  58. if (m_lCCTV == 0) return;
  59. AnsiString sCommand;
  60. AnsiString para;
  61. AnsiString sSpd;
  62. // cxTrackBar1->Min = 0, cxTrackBar1->Max = 6;
  63. if (teWeb->Text == "2") {
  64. sSpd = IntToStr(10 + (cxTrackBar1->Position * 15));
  65. }
  66. else {
  67. sSpd = IntToStr(cxTrackBar1->Position);
  68. }
  69. int iRow;
  70. int iTag = ((TSpeedButton *)Sender)->Tag;
  71. if (edRow->Text.Length() != 0) {
  72. iRow = StrToInt(edRow->Text);
  73. } else {
  74. return;
  75. }
  76. switch (iTag)
  77. {
  78. case 1:
  79. if (teWeb->Text == "2") {
  80. para = "/vb.htm?sendpandirection=4";
  81. }
  82. else {
  83. // sanyo camera
  84. para = "opecmd.cgi?ope=51&cmd=4&p_speed=" +sSpd; //Left
  85. }
  86. break;
  87. case 2:
  88. if (teWeb->Text == "2") {
  89. para = "/vb.htm?sendpandirection=6";
  90. }
  91. else {
  92. para = "opecmd.cgi?ope=51&cmd=5&p_speed=" +sSpd; //Right
  93. }
  94. break;
  95. case 3:
  96. if (teWeb->Text == "2") {
  97. para = "/vb.htm?sendpandirection=2";
  98. }
  99. else {
  100. para = "opecmd.cgi?ope=51&cmd=2&p_speed=" +sSpd; //Up
  101. }
  102. break;
  103. case 4:
  104. if (teWeb->Text == "2") {
  105. para = "/vb.htm?sendpandirection=8";
  106. }
  107. else {
  108. para = "opecmd.cgi?ope=51&cmd=7&p_speed=" +sSpd; //Down
  109. }
  110. break;
  111. case 5:
  112. if (teWeb->Text == "2") {
  113. para = "/vb.htm?sendfz=1";
  114. }
  115. else {
  116. para = "opecmd.cgi?ope=51&cmd=9&z_speed=" +sSpd; //ZommIn
  117. }
  118. break;
  119. case 6:
  120. if (teWeb->Text == "2") {
  121. para = "/vb.htm?sendfz=2";
  122. }
  123. else {
  124. para = "opecmd.cgi?ope=51&cmd=10&z_speed="+sSpd; //ZoomOut
  125. }
  126. break;
  127. case 7:
  128. if (teWeb->Text == "2") {
  129. return;
  130. }
  131. else {
  132. return; //Focusin
  133. }
  134. break;
  135. case 8:
  136. if (teWeb->Text == "2") {
  137. return;
  138. }
  139. else {
  140. return; //FocusOut
  141. }
  142. break;
  143. case 9:
  144. if (teWeb->Text == "2") {
  145. return;
  146. }
  147. else {
  148. para = "opecmd.cgi?ope=49&action=2"; //AutoFocus
  149. }
  150. break;
  151. }
  152. try {
  153. if (teWeb->Text == "2") {
  154. sCommand = "http://" + pCCTVList->Items[iRow]->sIP + para;
  155. } else {
  156. sCommand = "http://" + pCCTVList->Items[iRow]->sIP + "/cgi-bin/" + para;
  157. }
  158. m_pHTTP->Get(sCommand);
  159. fnWriteDebug(sCommand, 33333);
  160. } catch (Exception &e) {
  161. }
  162. }
  163. void __fastcall TCCTVCtrlF::SpeedButton10MouseUp(TObject *Sender, TMouseButton Button,
  164. TShiftState Shift, int X, int Y)
  165. {
  166. if (m_lCCTV == 0) return;
  167. AnsiString sCommand;
  168. AnsiString para;
  169. int iRow;
  170. int iTag = ((TSpeedButton *)Sender)->Tag;
  171. if (iTag > 6) return;
  172. if (edRow->Text.Length() != 0) {
  173. iRow = StrToInt(edRow->Text);
  174. } else {
  175. return;
  176. }
  177. switch (iTag)
  178. {
  179. case 1:
  180. case 2:
  181. case 3:
  182. case 4:
  183. if (teWeb->Text == "2") {
  184. para = "/vb.htm?sendstop=1";
  185. }
  186. else {
  187. para = "opecmd.cgi?ope=51&cmd=12&p_speed=0"; //Left, Right, Up, Down
  188. }
  189. break;
  190. case 5:
  191. case 6:
  192. if (teWeb->Text == "2") {
  193. para = "/vb.htm?sendstop=2";
  194. }
  195. else {
  196. para = "opecmd.cgi?ope=51&cmd=11&z_speed=0"; //ZommIn, ZoomOut
  197. }
  198. break;
  199. case 7:
  200. if (teWeb->Text == "2") {
  201. return;
  202. }
  203. else {
  204. return; //Focusin
  205. }
  206. break;
  207. case 8:
  208. if (teWeb->Text == "2") {
  209. return;
  210. }
  211. else {
  212. return; //FocusOut
  213. }
  214. break;
  215. }
  216. try {
  217. if (teWeb->Text == "2") {
  218. sCommand = "http://" + pCCTVList->Items[iRow]->sIP + para;
  219. } else {
  220. sCommand = "http://" + pCCTVList->Items[iRow]->sIP + "/cgi-bin/" + para;
  221. }
  222. m_pHTTP->Get(sCommand);
  223. } catch (Exception &e) {
  224. }
  225. }