uint8 portAccess(uint8 portNumber, uint8 bitMask, uint8 drive, uint8 high) {
	uint8 tempByte = 0x00;
	#ifdef DEBUG
		usartSendByteHex(portNumber);
		usartSendByte(':');
		usartSendByteHex(bitMask);
		usartSendByte(':');
		usartSendByteHex(drive);
		usartSendByte(':');
		usartSendByteHex(high);
		usartSendByte('\r');
	#endif
	switch ( portNumber ) {
	case 0:
		updatePort(A);
		break;
	case 1:
		updatePort(B);
		break;
	case 2:
		updatePort(C);
		break;
	case 3:
		updatePort(D);
		break;
	case 4:
		updatePort(E);
		break;
	}
	return tempByte;
}
示例#2
0
void IcqAccountMainSettings::onCurrentServerChanged(const QString &currentServer)
{
	if (!ui->sslBox->isChecked()) {
		if (defaultSslServers().values().contains(currentServer)) {
			ui->sslBox->setChecked(true);
			updatePort(true);
		}
	} else {
		if (defaultServers().contains(currentServer)) {
			ui->sslBox->setChecked(false);
			updatePort(false);
		}
	}
}
shared_ptr<PortMap> ThriftConfigApplier::updatePorts() {
    auto origPorts = orig_->getPorts();
    PortMap::NodeContainer newPorts;
    bool changed = false;

    // Process all supplied port configs
    for (const auto& portCfg : cfg_->ports) {
        PortID id(portCfg.logicalID);
        auto origPort = origPorts->getPortIf(id);
        if (!origPort) {
            throw FbossError("config listed for non-existent port ", id);
        }

        auto newPort = updatePort(origPort, &portCfg);
        changed |= updateMap(&newPorts, origPort, newPort);
    }

    // Find all ports that didn't have a config listed
    // and reset them to their default (disabled) state.
    for (const auto& origPort : *origPorts) {
        if (newPorts.find(origPort->getID()) != newPorts.end()) {
            // This port was listed in the config, and has already been configured
            continue;
        }
        cfg::Port defaultConfig;
        origPort->initDefaultConfig(&defaultConfig);
        auto newPort = updatePort(origPort, &defaultConfig);
        changed |= updateMap(&newPorts, origPort, newPort);
    }

    if (!changed) {
        return nullptr;
    }

    return origPorts->clone(newPorts);
}
示例#4
0
void IcqAccountMainSettings::onSslChecked(bool checked)
{
	// Update server if it is possible.
	QString currentServer = ui->serverBox->currentText();
	QString newServer = checked ?
						defaultSslServers().value(currentServer) :
						defaultSslServers().key(currentServer);
	if (!newServer.isEmpty()) {
		int newIndex = ui->serverBox->findText(newServer);
		if (newIndex == -1)
			ui->serverBox->setEditText(newServer);
		else
			ui->serverBox->setCurrentIndex(newIndex);
	}

	updatePort(checked);
}
示例#5
0
//-----------------------------------------------------------------------------
void GuiEditor::valueChanged (CControl* control)
{
	//effect->setParameterAutomated (control->getTag (), control->getValue ());

	float value;
	int ival;
	const char* text;
	std::string result;
	char* tempt;

	switch (control->getTag())
	{

		case kBufferSize:
			((COptionMenu*)(control))->getCurrent(tempt);
			ival = ((COptionMenu*)(control))->getIndex(tempt);
			updateBufferSize(ival);
			break;
	
		case kGain:
			value = control->getValue();
			result = floatToString(value*maxGain);
			gainDisplay->setText(result.c_str());
			updateGain(value*maxGain);
			break;

		case kGainText:
			text = ((CTextEdit*)(control))->getText();
			value = charToFloat(text);
			gainFader->setValue(value/(float)maxGain);
			updateGain(value);
			break;

		case kXScale:
			value = control->getValue();
			result = floatToString(value*maxXScale);
			xScaleDisplay->setText(result.c_str());
			updateXScale(value*maxXScale);
			break;

		case kXScaleText:
			text = ((CTextEdit*)(control))->getText();
			value = charToFloat(text);
			xScaleFader->setValue(value/(float)maxXScale);
			updateXScale(value);
			break;

		case kYScale:
			value = control->getValue();
			result = floatToString(value*maxYScale);
			yScaleDisplay->setText(result.c_str());
			updateYScale(value*maxYScale);
			break;

		case kYScaleText:
			text = ((CTextEdit*)(control))->getText();
			value = charToFloat(text);
			yScaleFader->setValue(value/(float)maxYScale);
			updateYScale(value);
			break;

		case kResponse:
			value = control->getValue();
			result = floatToString(value);
			responseDisplay->setText(result.c_str());
			updateResponse(value);
			break;

		case kResponseText:
			text = ((CTextEdit*)(control))->getText();
			value = charToFloat(text);
			responseFader->setValue(value);
			updateResponse(value);
			break;

		case kBands:
			ival = (int)(control->getValue()*maxBands);
			result = intToString(ival);
			bandsDisplay->setText(result.c_str());
			bandsFader->setValue(((float)ival)/(float)maxBands);
			updateBands(ival);
			break;

		case kBandsText:
			text = ((CTextEdit*)(control))->getText();
			ival = charToInt(text);
			bandsFader->setValue((float)value/(float)maxBands);
			updateBands(ival);
			break;

		case kAmpScale:
			((COptionMenu*)(control))->getCurrent(tempt);
			ival = ((COptionMenu*)(control))->getIndex(tempt);
			updateAmpScale(ival);
			break;

		case kType:
			((COptionMenu*)(control))->getCurrent(tempt);
			ival = ((COptionMenu*)(control))->getIndex(tempt);
			updateType(ival);
			break;

		case kDisplay:
			((COptionMenu*)(control))->getCurrent(tempt);
			ival = ((COptionMenu*)(control))->getIndex(tempt);
			updateDisplayt(ival);
			break;

		case kResampling:
			((COptionMenu*)(control))->getCurrent(tempt);
			ival = ((COptionMenu*)(control))->getIndex(tempt);
			updateResampling(ival);
			break;

		case kFreqScale:
			((COptionMenu*)(control))->getCurrent(tempt);
			ival = ((COptionMenu*)(control))->getIndex(tempt);
			updateFreqScale(ival);
			break;



		case kAddress:
			text = ((CTextEdit*)(control))->getText();
			updateAddress(text);
			break;

		case kPort:
			text = ((CTextEdit*)(control))->getText();
			ival = charToInt(text);
			updatePort(ival);
			break;

		case kHost:
			text = ((CTextEdit*)(control))->getText();
			updateHost(text);
			break;
	}

}