Exemplo n.º 1
0
void NHandsFree::
NextCommand(NHandsFreeCmd *cmdp, bool success)
{
	if (m_ag_state == NHS_AG_INVALID) {
		/*
		 * We should have received some state when we asked
		 * after the connection completed
		 */
		AbortConnection();
		return;
	}

	if (m_ag_state == NHS_AG_NOBT) {
		QueueCommand(new NormalCommand("START"));
		return;
	}

	if (m_ag_state == NHS_AG_NODEV) {
		/* Bind it to our device */
		char buf[64];
		sprintf(buf, "BIND 00:14:9A:48:5F:A8");
		QueueCommand(new AbortOnFailCommand(buf));
		return;
	}

	if ((m_ag_state == NHS_AG_DISCON) && !m_ag_connect_sent) {
		/* Initiate a connection attempt */
		m_ag_connect_sent = true;
		QueueCommand(new NormalCommand("CONNECT"));
		return;
	}

	/* Otherwise there isn't much for us to do */
}
void CDB_driver::Step()
{
    ResetCursor();
    QueueCommand(new DebuggerContinueBaseCmd(this, _T("p")));
    // print a stack frame to find out about the file we 've stopped
    QueueCommand(new CdbCmd_SwitchFrame(this, -1));
}
void CDB_driver::Prepare(cb_unused bool isConsole, cb_unused int printElements)
{
	// The very first command won't get the right output back due to the spam on CDB launch.
	// Throw in a dummy command to flush the output buffer.
	m_QueueBusy = true;
	QueueCommand(new DebuggerCmd(this,_T(".echo Clear buffer")),High);

	// Either way, get the PID of the child
	QueueCommand(new CdbCmd_GetPID(this));
}
void CDB_driver::Start(cb_unused bool breakOnEntry)
{
    // start the process
    QueueCommand(new DebuggerCmd(this, _T("l+t"))); // source mode
    QueueCommand(new DebuggerCmd(this, _T("l+s"))); // show source lines
    QueueCommand(new DebuggerCmd(this, _T("l+o"))); // only source lines

    if (!m_pDBG->GetActiveConfigEx().GetFlag(DebuggerConfiguration::DoNotRun))
    {
        QueueCommand(new CdbCmd_Continue(this));
        m_IsStarted = true;
    }
}
Exemplo n.º 5
0
void idev_BeginIO(IDBase *IDBase, struct IORequest *io)
{
	UINT8 cmd = io->io_Command;
	io->io_Flags &= (~(IOF_QUEUED|IOF_CURRENT|IOF_SERVICING|IOF_DONE))&0x0ff;
	io->io_Error = 0;

	if (cmd > MD_SETTRIGGER) cmd = 0; // Invalidate the command.

	if (inputCmdQuick[cmd] >= 0)
	{
		QueueCommand((struct IOStdReq*)io, SysBase);
		// Check if we are the first in Queue, if not, just return
		if (!TEST_BITS(io->io_Flags, IOF_CURRENT))
		{
			CLEAR_BITS(io->io_Flags, IOF_QUICK);
			return;
		}
		// If Device is stopped, just return
		if (TEST_BITS(IDBase->Unit.unit_Flags, DUB_STOPPED))
		{
			CLEAR_BITS(io->io_Flags, IOF_QUICK);
			return;
		}
		// we are first in Queue, now we are Quick, otherwise we come from the IS Routine
	}
	inputCmdVector[cmd]((struct IOStdReq*) io, IDBase);
}
Exemplo n.º 6
0
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
void CEditorSystem::PasteSelection()
{
	if( m_SelectionCopyCommands.Count() == 0 )
		return;

	// Clear selection, will select copy!
	KeyValues *pClearSelection = CreateClearSelectionCommand();
	QueueCommand( pClearSelection );

	for( int i = 0; i < m_SelectionCopyCommands.Count(); i++ )
	{
		QueueCommand( m_SelectionCopyCommands[i] );
	}

	m_SelectionCopyCommands.Purge();
}
Exemplo n.º 7
0
void NHandsFree::
Connected(void)
{
	NHandsFreeCmd *cmdp;
	cmdp = new AbortOnFailCommand("STATE");
	QueueCommand(cmdp);
}
void tSmartCraftCruiseCtlInstance::SendCruiseCmd( const quint8 srcCityId, const tSmartCraftCruiseCtlInstance::tCruiseCtlCmd cmd )
{
    m_CruiseCtlCmd = cmd;
    m_CruiseCtlCmd.m_SrcCityId = srcCityId;

    if( cmd.m_Mode == tCruiseCtlInfo::eCCM_NoChange )
    {
        m_CruiseCtlCmd.m_Mode = m_pCruiseCtlInfo->m_Mode;
    }

    QueueCommand( eCCIC_TxCruiseCtlCmd );
}
Exemplo n.º 9
0
void QueueManager::SetAllTo(bool on)
{
    Channel channel;
    Unit unit;

    for (map<QString, Container*>::const_iterator itr = Containers.begin();
            itr != Containers.end(); ++itr)
    {
        if (X10::sourceToAddress(itr->first, channel, unit))
            QueueCommand(on ? CMD_ON : CMD_OFF, channel, unit, on ? -2 : -1);
    }
}
Exemplo n.º 10
0
void QueueManager::on_RuleExecute(Rule rule)
{
    Logger::Log(INFO, "Rule execution command %s", qPrintable(rule.getDisplayText()) );
    vector<COMMAND> listCmds = rule.getCommands();

    if (!listCmds.size()) {
        Logger::Log(ERROR, "on_RuleExecute, no commands resulted from rule %s",
                    qPrintable(rule.getDisplayText()) );
    } else {
        for (uint i=0; i<listCmds.size(); i++)
            QueueCommand(listCmds[i]);
    }
}
Exemplo n.º 11
0
void NHandsFree::
onAction(ActionClass action)
{
	if (action.name == "connect") {
		if (m_hfpd_state == NHS_HFPD_DISCONNECTED) {
			/* Reconnect to hfpd */
			InetConnect(1234);
		}
		return;
	}

	if (action.name == "answer") {
		IncomingCallPopUp(false);
		QueueCommand(new AbortOnFailCommand("ANSWER"));
		return;
	}

	if (action.name == "drop") {
		IncomingCallPopUp(false);
		QueueCommand(new AbortOnFailCommand("HANGUP"));
		return;
	}
}
void CDB_driver::UpdateWatches(cb_unused cb::shared_ptr<GDBWatch> localsWatch,
                               cb_unused cb::shared_ptr<GDBWatch> funcArgsWatch,
                               WatchesContainer &watches)
{
    bool updateWatches = false;
    for (WatchesContainer::iterator it = watches.begin(); it != watches.end(); ++it)
    {
        WatchesContainer::reference watch = *it;
        if (watch->IsAutoUpdateEnabled())
        {
            QueueCommand(new CdbCmd_Watch(this, *it));
            updateWatches = true;
        }
    }

    if (updateWatches)
        QueueCommand(new DbgCmd_UpdateWatchesTree(this));

    // FIXME (obfuscated#): reimplement this code
//    // start updating watches tree
//    tree->BeginUpdateTree();
//
//    // locals before args because of precedence
//    if (doLocals)
//        QueueCommand(new CdbCmd_InfoLocals(this, tree));
////    if (doArgs)
////        QueueCommand(new CdbCmd_InfoArguments(this, tree));
//    for (unsigned int i = 0; i < tree->GetWatches().GetCount(); ++i)
//    {
//        Watch& w = tree->GetWatches()[i];
//        QueueCommand(new CdbCmd_Watch(this, tree, &w));
//    }
//
//    // run this action-only command to update the tree
//    QueueCommand(new DbgCmd_UpdateWatchesTree(this, tree));
}
Exemplo n.º 13
0
void CMediaMonitor::Process()
{
  InitializeObserver();

  CMediaMonitor::Command command;
  command.rCommand = CMediaMonitor::CommandType::Refresh;
  QueueCommand(command);

  while (!m_bStop)
  {
    switch ( WaitForSingleObject(m_hCommand, INFINITE) )
    {
    case WAIT_OBJECT_0:
      m_bBusy = true;
      DispatchNextCommand();
      m_bBusy = false;
      break;
    }
  }
}
Exemplo n.º 14
0
void Audio::QueueResumeCommand()
{
	QueueCommand(String("resume ") + m_Alias);
}
Exemplo n.º 15
0
void Audio::QueueStopCommand()
{
	QueueCommand(String("stop ") + m_Alias);
}
void CDB_driver::Detach()
{
    QueueCommand(new CdbCmd_Detach(this));
}
void CDB_driver::UpdateWatch(const cb::shared_ptr<GDBWatch> &watch)
{
    QueueCommand(new CdbCmd_Watch(this, watch));
    QueueCommand(new DbgCmd_UpdateWatchesTree(this));
}
void CDB_driver::Continue()
{
    ResetCursor();
    QueueCommand(new CdbCmd_Continue(this));
    m_IsStarted = true;
}
Exemplo n.º 19
0
void QueueManager::QueueCommand(const COMMAND& cmd)
{
    CheckService();

    QString listNodes = NodesList();
    QStringList nodes = listNodes.split(" ", QString::SkipEmptyParts);

    if (cmd.channel == '*' || cmd.unit == 0)
    {
        Logger::Log(INFO, "Incoming Generic Command %s", qPrintable(cmd.commandStr()));
        char nodeChannel = 'A';
        int nodeUnit = 0;
        bool bMatch = false;
        for (int i=0; i<nodes.count(); i++)
        {
            X10::sourceToAddress(nodes[i], nodeChannel, nodeUnit);
            if ( ((cmd.channel == '*' ) || (nodeChannel == cmd.channel)) &&
                    ((cmd.unit == 0 ) || (nodeUnit == cmd.unit)) )
            {
                // match desired pattern E0 * *2 among known containers
                QueueCommand(COMMAND(nodeChannel, nodeUnit, cmd.command, cmd.value));
                bMatch = true;
            }
        }
        if (!bMatch) {
            Logger::Log(INFO, "No source matching %s in nodes list (%s)",
                        qPrintable(cmd.address()), qPrintable(listNodes) );
        }
        return;
    }

    Logger::Log(INFO, "Incoming Command %s", qPrintable(cmd.commandStr()));

    const QMutexLocker locker(&m_mutex);

    //check existing commmand
    if (config.SMART_QUEUE)
    {
        for (std::list<COMMAND*>::iterator itr = m_queueCommands.begin(); itr != m_queueCommands.end();)
        {
            COMMAND* cmdit = *itr;

            // same channel / unit ?
            if ((cmd.channel == cmdit->channel) && (cmd.unit == cmdit->unit))
            {
                if (cmd.command == CMD_SET)
                {
                    // SET erase all other command
//                     Logger::Log(DEBUG, "Incoming SET %s CANCELLED queued command %s", qPrintable(cmd.commandStr()), qPrintable(cmdit->commandStr()));
                    itr = m_queueCommands.erase(itr);
                    continue;
                }
                else if (cmd.command == CMD_OFF)
                {
                    // OFF erase all other command
//                     Logger::Log(DEBUG, "Incoming Stop %s CANCELLED queued command %s", qPrintable(cmd.commandStr()), qPrintable(cmdit->commandStr()));
                    itr = m_queueCommands.erase(itr);
                    continue;
                }
                else if (cmd.command == CMD_BRIGHT || cmd.command == CMD_DIM)
                {
                    if (cmdit->command != cmd.command) // reverse direction, remove both commands
                    {
//                         Logger::Log(DEBUG, "Incoming command %s CANCELLED queued command %s", qPrintable(cmd.commandStr()), qPrintable(cmdit->commandStr()));
                        itr = m_queueCommands.erase(itr);
                        return;
                    }
                }
            }
            ++itr;
        } // end for
    } // end smart queue

    // enqueue
    m_queueCommands.push_front(new COMMAND(cmd));
    queueNotEmpty.wakeOne();
}
void CDB_driver::SwitchToFrame(size_t number)
{
    ResetCursor();
    QueueCommand(new CdbCmd_SwitchFrame(this, number));
}
void CDB_driver::CPURegisters()
{
    QueueCommand(new CdbCmd_InfoRegisters(this));
}
void CDB_driver::Disassemble()
{
    QueueCommand(new CdbCmd_DisassemblyInit(this));
}
Exemplo n.º 23
0
void Audio::QueueVolumeCommand(int volume)
{
	QueueCommand(String("setaudio ") + m_Alias + " volume to " + volume * 10);
}
void CDB_driver::StepOut()
{
    ResetCursor();
    QueueCommand(new DebuggerContinueBaseCmd(this, _T("gu")));
    QueueCommand(new CdbCmd_SwitchFrame(this, -1));
}
void CDB_driver::StepIn()
{
    ResetCursor();
    QueueCommand(new DebuggerContinueBaseCmd(this, _T("t")));
    Step();
}
void CDB_driver::RemoveBreakpoint(cb::shared_ptr<DebuggerBreakpoint> bp)
{
    QueueCommand(new CdbCmd_RemoveBreakpoint(this, bp));
}
Exemplo n.º 27
0
void QueueManager::QueueCommand(COMMAND_TYPE command, Channel channel, Unit unit, int value)
{
    COMMAND* cmd = new COMMAND(channel, unit, command, value);
    QueueCommand(*cmd);
}
void CDB_driver::EvaluateSymbol(const wxString& symbol, const wxRect& tipRect)
{
    QueueCommand(new CdbCmd_TooltipEvaluation(this, symbol, tipRect));
}
void CDB_driver::DoBacktrace(bool switchToFirst)
{
    if (Manager::Get()->GetDebuggerManager()->UpdateBacktrace())
        QueueCommand(new CdbCmd_Backtrace(this, switchToFirst));
}
void CDB_driver::Stop()
{
    ResetCursor();
    QueueCommand(new DebuggerCmd(this, _T("q")));
    m_IsStarted = false;
}