Changes in / [1:3]


Ignore:
Location:
/trunk/HarmonyHubControl
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • /trunk/HarmonyHubControl/README.txt

    r1 r3  
    7171The command line for HarmonyHubControl is as follows: 
    7272 
    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"); 
    7474     
    7575where the [email] and [password] parameters are the login credentials used to log  
     
    8686    list_activities 
    8787    start_activity [ID] 
     88        issue_device_command [DEVICE_ID] [DEVICE_COMMAND] 
    8889    get_config 
    8990 
     
    116117-------------------- 
    117118 
    118 Finish the "issue_command" interface to allow individual commands to be sent to devices. 
    119119Re-organize the code into a library 
  • /trunk/HarmonyHubControl/csocket.cpp

    r1 r3  
    3737    } 
    3838      
    39     m_socket = NULL; 
     39    m_socket = 0; 
    4040} 
    4141 
  • /trunk/HarmonyHubControl/HarmonyHubControl.cpp

    r1 r3  
    2121#include <algorithm> 
    2222#include <string> 
     23#include <iostream> 
    2324#include <map> 
    2425#include "csocket.h" 
     
    3334#define CONNECTION_ID "12345678-1234-5678-1234-123456789012-1" 
    3435 
    35 #include <iostream> 
     36#ifdef WIN32 
     37#define sprintf sprintf_s 
     38#endif 
     39 
    3640 
    3741static const std::string base64_chars =  
     
    340344 
    341345 
    342 int submitCommand(csocket* commandcsocket, std::string& strAuthorizationToken, std::string strCommand, std::string strCommandParameter, std::string strCommandParameterTwo) 
     346int submitCommand(csocket* commandcsocket, std::string& strAuthorizationToken, std::string strCommand, std::string strCommandParameterPrimary, std::string strCommandParameterSecondary) 
    343347{ 
    344348    if(commandcsocket== NULL || strAuthorizationToken.length() == 0) 
     
    376380    { 
    377381        sendData.append("startactivity\">activityId="); 
    378         sendData.append(strCommandParameter.c_str()); 
     382        sendData.append(strCommandParameterPrimary.c_str()); 
    379383        sendData.append(":timestamp=0</oa></iq>"); 
    380384    } 
    381     else if (lstrCommand == "issue_action") 
     385    else if (lstrCommand == "issue_device_command") 
    382386    { 
    383387        sendData.append("holdAction\">action={\"type\"::\"IRCommand\",\"deviceId\"::\""); 
    384         sendData.append(strCommandParameter.c_str()); 
     388        sendData.append(strCommandParameterPrimary.c_str()); 
    385389        sendData.append("\",\"command\"::\""); 
    386         sendData.append(strCommandParameterTwo.c_str()); 
     390        sendData.append(strCommandParameterSecondary.c_str()); 
    387391        sendData.append("\"}:status=press</oa></iq>"); 
    388392    } 
     
    411415    } 
    412416 
    413     if(strCommand != "issue_action") 
     417    if(strCommand != "issue_device_command") 
    414418    { 
    415419        while(bIsDataReadable) 
     
    451455        } 
    452456    } 
    453     else if (strCommand == "start_activity" || strCommand == "issue_action") 
     457    else if (strCommand == "start_activity" || strCommand == "issue_device_command") 
    454458    { 
    455459        resultString = ""; 
     
    510514        printf("        get_current_activity_id\n"); 
    511515        printf("        start_activity [ID]\n"); 
    512         printf("        issue_action [deviceId] [command]\n"); 
     516        printf("        issue_device_command [deviceId] [command]\n"); 
    513517        printf("        list_devices\n"); 
    514518        printf("        get_config\n"); 
     
    521525    std::string strHarmonyIP = argv[3]; 
    522526    std::string strCommand; 
    523     std::string strCommandParameter; 
    524     std::string strCommandParameterTwo; 
     527    std::string strCommandParameterPrimary; 
     528    std::string strCommandParameterSecondary; 
    525529     
    526530    int harmonyPortNumber = HARMONY_COMMUNICATION_PORT; 
     
    533537    if(argc>=6) 
    534538    { 
    535         strCommandParameter = argv[5]; 
     539        strCommandParameterPrimary = argv[5]; 
    536540    } 
    537541 
    538542    if(argc==7) 
    539543    { 
    540         strCommandParameterTwo = argv[6]; 
    541     } 
    542  
    543     //QNetworkProxyFactory::setUseSystemConfiguration(true); 
     544        strCommandParameterSecondary = argv[6]; 
     545    } 
     546 
    544547 
    545548    printf("LOGITECH WEB SERVICE LOGIN     : "); 
     
    613616    } 
    614617 
    615     if(submitCommand(&commandcsocket, strAuthorizationToken, lstrCommand, strCommandParameter, strCommandParameterTwo) == 1) 
     618    if(submitCommand(&commandcsocket, strAuthorizationToken, lstrCommand, strCommandParameterPrimary, strCommandParameterSecondary) == 1) 
    616619    { 
    617620        printf("FAILURE\n"); 
Note: See TracChangeset for help on using the changeset viewer.