Subversion Repositories tpanel

Rev

Rev 449 | Rev 458 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 449 Rev 457
Line 1024... Line 1024...
1024
    REG_CMD(doMUT, "^MUT");     // G5: Panel Volume Mute
1024
    REG_CMD(doMUT, "^MUT");     // G5: Panel Volume Mute
1025
    REG_CMD(doTKP, "@TKP");     // Present a telephone keypad.
1025
    REG_CMD(doTKP, "@TKP");     // Present a telephone keypad.
1026
    REG_CMD(doTKP, "^TKP");     // G5: Bring up a telephone keypad.
1026
    REG_CMD(doTKP, "^TKP");     // G5: Bring up a telephone keypad.
1027
    REG_CMD(doTKP, "@VKB");     // Present a virtual keyboard
1027
    REG_CMD(doTKP, "@VKB");     // Present a virtual keyboard
1028
    REG_CMD(doTKP, "^VKB");     // G5: Bring up a virtual keyboard.
1028
    REG_CMD(doTKP, "^VKB");     // G5: Bring up a virtual keyboard.
-
 
1029
    // Audio communication
-
 
1030
    REG_CMD(getMODEL, "^MODEL?"); // Panel model name.
-
 
1031
    REG_CMD(doICS, "^ICS");     // Intercom start
-
 
1032
    REG_CMD(doICE, "^ICE");     // Intercom end
-
 
1033
    REG_CMD(doICM, "^ICM");     // Intercom modify command
1029
#ifndef _NOSIP_
1034
#ifndef _NOSIP_
1030
    // Here the SIP commands will take place
1035
    // Here the SIP commands will take place
1031
    REG_CMD(doPHN, "^PHN");     // SIP commands
1036
    REG_CMD(doPHN, "^PHN");     // SIP commands
1032
    REG_CMD(getPHN, "?PHN");    // SIP state commands
1037
    REG_CMD(getPHN, "?PHN");    // SIP state commands
1033
#endif
1038
#endif
Line 11517... Line 11522...
11517
{
11522
{
11518
    DECL_TRACER("TPageManager::doVKB(int port, vector<int>& channels, vector<string>& pars)");
11523
    DECL_TRACER("TPageManager::doVKB(int port, vector<int>& channels, vector<string>& pars)");
11519
 
11524
 
11520
    doAKP(port, channels, pars);
11525
    doAKP(port, channels, pars);
11521
}
11526
}
-
 
11527
 
-
 
11528
/**
-
 
11529
 * Panel model name. If the panel supports intercom hardware it will respond
-
 
11530
 * with its model name. Older hardware or newer hardware that has intercom
-
 
11531
 * support disabled with not respond to this command.
-
 
11532
 */
-
 
11533
void TPageManager::getMODEL(int, vector<int>&, vector<string>&)
-
 
11534
{
-
 
11535
    DECL_TRACER("TPageManager::getMODEL(int, vector<int>&, vector<string>&)");
-
 
11536
 
-
 
11537
    amx::ANET_SEND scmd;
-
 
11538
    scmd.port = mTSettings->getSettings().voipCommandPort;
-
 
11539
    scmd.channel = TConfig::getChannel();
-
 
11540
#ifdef Q_OS_IOS
-
 
11541
    scmd.msg = "^MODEL-iPhonei";
-
 
11542
#elif defined(Q_OS_ANDROID)
-
 
11543
    scmd.msg = "^MODEL-Androidi";
-
 
11544
#else
-
 
11545
    scmd.msg = TConfig::getPanelType();
-
 
11546
#endif
-
 
11547
    scmd.MC = 0x008c;
-
 
11548
    MSG_DEBUG("Sending model: " << scmd.msg);
-
 
11549
 
-
 
11550
    if (gAmxNet)
-
 
11551
        gAmxNet->sendCommand(scmd);
-
 
11552
    else
-
 
11553
        MSG_WARNING("Missing global class TAmxNet. Can't send model type!");
-
 
11554
}
-
 
11555
 
-
 
11556
/**
-
 
11557
 * @brief Intercom start.
-
 
11558
 * Starts a call to the specified IP address and ports, where initial mode is
-
 
11559
 * either 1 (talk) or 0 (listen) or 2 (both). If no mode is specified
-
 
11560
 * 0 (listen) is assumed. Please note, however, that no data packets will
-
 
11561
 * actually flow until the intercom modify command is sent to the panel.
-
 
11562
 */
-
 
11563
void TPageManager::doICS(int, vector<int>&, vector<string>& pars)
-
 
11564
{
-
 
11565
    if (pars.size() < 3)
-
 
11566
    {
-
 
11567
        MSG_ERROR("Command ICS expects 3 parameters but got only " << pars.size());
-
 
11568
        return;
-
 
11569
    }
-
 
11570
 
-
 
11571
    string ip = pars[0];
-
 
11572
    int txPort = atoi(pars[1].c_str());
-
 
11573
    int rxPort = atoi(pars[2].c_str());
-
 
11574
    int mode = 0;
-
 
11575
 
-
 
11576
    if (pars.size() >= 4)
-
 
11577
        mode = atoi(pars[3].c_str());
-
 
11578
 
-
 
11579
    // TODO: Add code to initialize the communication
-
 
11580
}
-
 
11581
 
-
 
11582
/**
-
 
11583
 * @brief Intercom end.
-
 
11584
 * This terminates an intercom call/connection.
-
 
11585
 */
-
 
11586
void TPageManager::doICE(int, vector<int>&, vector<string>&)
-
 
11587
{
-
 
11588
    //TODO: Add call to stop communication
-
 
11589
}
-
 
11590
 
-
 
11591
/**
-
 
11592
 * Intercom modify command.
-
 
11593
 */
-
 
11594
void TPageManager::doICM(int, vector<int>&, vector<string>& pars)
-
 
11595
{
-
 
11596
    if (pars.empty() || pars[0] == "TALK" || pars[0] == "LISTEN")
-
 
11597
    {
-
 
11598
        // TODO: Add call to start communication as initialized
-
 
11599
    }
-
 
11600
    else if (pars[0] == "MICLEVEL" && pars.size() >= 2)
-
 
11601
    {
-
 
11602
        int micLevel = atoi(pars[1].c_str());
-
 
11603
 
-
 
11604
        if (micLevel < 0 || micLevel > 100)
-
 
11605
        {
-
 
11606
            MSG_WARNING("Microphon level is out of range [0 ... 100]: " << micLevel);
-
 
11607
            return;
-
 
11608
        }
-
 
11609
 
-
 
11610
        TConfig::saveSystemGain(micLevel);
-
 
11611
        // TODO: Add code to set the microphon level
-
 
11612
    }
-
 
11613
    else if (pars[0] == "MUTEMIC" && pars.size() >= 2)
-
 
11614
    {
-
 
11615
        int mute = atoi(pars[1].c_str());
-
 
11616
        bool bmute = mute == 0 ? false : true;
-
 
11617
        // TODO: Add code to set mute microphone
-
 
11618
    }
-
 
11619
    else if (pars[0] == "SPEAKERLEVEL" && pars.size() >= 2)
-
 
11620
    {
-
 
11621
        int speakerLevel = atoi(pars[1].c_str());
-
 
11622
 
-
 
11623
        if (speakerLevel < 0 || speakerLevel > 100)
-
 
11624
        {
-
 
11625
            MSG_WARNING("Speaker level is out of range [0 ... 100]: " << speakerLevel);
-
 
11626
            return;
-
 
11627
        }
-
 
11628
 
-
 
11629
        TConfig::saveSystemVolume(speakerLevel);
-
 
11630
        // TODO: Add code to set the speaker level
-
 
11631
    }
-
 
11632
}
-
 
11633
 
11522
#ifndef _NOSIP_
11634
#ifndef _NOSIP_
11523
void TPageManager::sendPHN(vector<string>& cmds)
11635
void TPageManager::sendPHN(vector<string>& cmds)
11524
{
11636
{
11525
    DECL_TRACER("TPageManager::sendPHN(const vector<string>& cmds)");
11637
    DECL_TRACER("TPageManager::sendPHN(const vector<string>& cmds)");
11526
 
11638