- Location:
- /trunk/HarmonyHubControl
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
/trunk/HarmonyHubControl/README.txt
r1 r3 71 71 The command line for HarmonyHubControl is as follows: 72 72 73 HarmonyHubControl.exe [email] [password] [harmony_ip] [command (optional)] \n");73 HarmonyHubControl.exe [email] [password] [harmony_ip] [command (optional)] [primary_parameter (optional)] [secondary_parameter (optional)]\n"); 74 74 75 75 where the [email] and [password] parameters are the login credentials used to log … … 86 86 list_activities 87 87 start_activity [ID] 88 issue_device_command [DEVICE_ID] [DEVICE_COMMAND] 88 89 get_config 89 90 … … 116 117 -------------------- 117 118 118 Finish the "issue_command" interface to allow individual commands to be sent to devices.119 119 Re-organize the code into a library -
/trunk/HarmonyHubControl/csocket.cpp
r1 r3 37 37 } 38 38 39 m_socket = NULL;39 m_socket = 0; 40 40 } 41 41 -
/trunk/HarmonyHubControl/HarmonyHubControl.cpp
r1 r3 21 21 #include <algorithm> 22 22 #include <string> 23 #include <iostream> 23 24 #include <map> 24 25 #include "csocket.h" … … 33 34 #define CONNECTION_ID "12345678-1234-5678-1234-123456789012-1" 34 35 35 #include <iostream> 36 #ifdef WIN32 37 #define sprintf sprintf_s 38 #endif 39 36 40 37 41 static const std::string base64_chars = … … 340 344 341 345 342 int submitCommand(csocket* commandcsocket, std::string& strAuthorizationToken, std::string strCommand, std::string strCommandParameter , std::string strCommandParameterTwo)346 int submitCommand(csocket* commandcsocket, std::string& strAuthorizationToken, std::string strCommand, std::string strCommandParameterPrimary, std::string strCommandParameterSecondary) 343 347 { 344 348 if(commandcsocket== NULL || strAuthorizationToken.length() == 0) … … 376 380 { 377 381 sendData.append("startactivity\">activityId="); 378 sendData.append(strCommandParameter .c_str());382 sendData.append(strCommandParameterPrimary.c_str()); 379 383 sendData.append(":timestamp=0</oa></iq>"); 380 384 } 381 else if (lstrCommand == "issue_ action")385 else if (lstrCommand == "issue_device_command") 382 386 { 383 387 sendData.append("holdAction\">action={\"type\"::\"IRCommand\",\"deviceId\"::\""); 384 sendData.append(strCommandParameter .c_str());388 sendData.append(strCommandParameterPrimary.c_str()); 385 389 sendData.append("\",\"command\"::\""); 386 sendData.append(strCommandParameter Two.c_str());390 sendData.append(strCommandParameterSecondary.c_str()); 387 391 sendData.append("\"}:status=press</oa></iq>"); 388 392 } … … 411 415 } 412 416 413 if(strCommand != "issue_ action")417 if(strCommand != "issue_device_command") 414 418 { 415 419 while(bIsDataReadable) … … 451 455 } 452 456 } 453 else if (strCommand == "start_activity" || strCommand == "issue_ action")457 else if (strCommand == "start_activity" || strCommand == "issue_device_command") 454 458 { 455 459 resultString = ""; … … 510 514 printf(" get_current_activity_id\n"); 511 515 printf(" start_activity [ID]\n"); 512 printf(" issue_ action[deviceId] [command]\n");516 printf(" issue_device_command [deviceId] [command]\n"); 513 517 printf(" list_devices\n"); 514 518 printf(" get_config\n"); … … 521 525 std::string strHarmonyIP = argv[3]; 522 526 std::string strCommand; 523 std::string strCommandParameter ;524 std::string strCommandParameter Two;527 std::string strCommandParameterPrimary; 528 std::string strCommandParameterSecondary; 525 529 526 530 int harmonyPortNumber = HARMONY_COMMUNICATION_PORT; … … 533 537 if(argc>=6) 534 538 { 535 strCommandParameter = argv[5];539 strCommandParameterPrimary = argv[5]; 536 540 } 537 541 538 542 if(argc==7) 539 543 { 540 strCommandParameterTwo = argv[6]; 541 } 542 543 //QNetworkProxyFactory::setUseSystemConfiguration(true); 544 strCommandParameterSecondary = argv[6]; 545 } 546 544 547 545 548 printf("LOGITECH WEB SERVICE LOGIN : "); … … 613 616 } 614 617 615 if(submitCommand(&commandcsocket, strAuthorizationToken, lstrCommand, strCommandParameter , strCommandParameterTwo) == 1)618 if(submitCommand(&commandcsocket, strAuthorizationToken, lstrCommand, strCommandParameterPrimary, strCommandParameterSecondary) == 1) 616 619 { 617 620 printf("FAILURE\n");
Note: See TracChangeset
for help on using the changeset viewer.