static int open_dchannel(struct hfcsusb *hw, struct mISDNchannel *ch, struct channel_req *rq) { int err = 0; if (debug & DEBUG_HW_OPEN) printk(KERN_DEBUG "%s: %s: dev(%d) open addr(%i) from %p\n", hw->name, __func__, hw->dch.dev.id, rq->adr.channel, __builtin_return_address(0)); if (rq->protocol == ISDN_P_NONE) return -EINVAL; test_and_clear_bit(FLG_ACTIVE, &hw->dch.Flags); test_and_clear_bit(FLG_ACTIVE, &hw->ech.Flags); hfcsusb_start_endpoint(hw, HFC_CHAN_D); if (rq->adr.channel == 1) { if (hw->fifos[HFCUSB_PCM_RX].pipe) { hfcsusb_start_endpoint(hw, HFC_CHAN_E); set_bit(FLG_ACTIVE, &hw->ech.Flags); _queue_data(&hw->ech.dev.D, PH_ACTIVATE_IND, MISDN_ID_ANY, 0, NULL, GFP_ATOMIC); } else return -EINVAL; } if (!hw->initdone) { hw->protocol = rq->protocol; if (rq->protocol == ISDN_P_TE_S0) { err = create_l1(&hw->dch, hfc_l1callback); if (err) return err; } setPortMode(hw); ch->protocol = rq->protocol; hw->initdone = 1; } else { if (rq->protocol != ch->protocol) return -EPROTONOSUPPORT; } if (((ch->protocol == ISDN_P_NT_S0) && (hw->dch.state == 3)) || ((ch->protocol == ISDN_P_TE_S0) && (hw->dch.state == 7))) _queue_data(ch, PH_ACTIVATE_IND, MISDN_ID_ANY, 0, NULL, GFP_KERNEL); rq->ch = ch; if (!try_module_get(THIS_MODULE)) printk(KERN_WARNING "%s: %s: cannot get module\n", hw->name, __func__); return 0; }
void PropertiesManager::createEventPortProperties(EventPortTextItem *ep) { //move up down root->actionMove_Up->setEnabled(true); root->actionMove_Down->setEnabled(true); root->actionDeleteItems->setEnabled(true); QLabel *label = new QLabel("<b>Edit Event Port</b>"); addRow(label); QComboBox *mode = new QComboBox(); mode->addItem("Send"); mode->addItem("Receive"); EventPortMode m = ep->getPortMode(); switch(m){ case(EventSendPort):{ mode->setCurrentIndex(0); break; } case(EventRecvPort):{ mode->setCurrentIndex(1); break; } default:{ mode->setCurrentIndex(-1); } } connect(mode, SIGNAL(currentIndexChanged(QString)), ep, SLOT(setPortMode(QString))); addRow(tr("Event &Mode:"), mode); QLineEdit *name = new QLineEdit(); name->installEventFilter(&eventFilterObject); name->setText(ep->getName()); name->setValidator(validator); connect(name, SIGNAL(textEdited(QString)), ep, SLOT(setName(QString))); addRow(tr("&Name:"),name); }
void PropertiesManager::createImpulsePortProperties(ImpulsePortTextItem *ip) { //move up down root->actionMove_Up->setEnabled(true); root->actionMove_Down->setEnabled(true); root->actionDeleteItems->setEnabled(true); QLabel *label = new QLabel("<b>Edit Impulse Port</b>"); addRow(label); ImpulsePortMode m = ip->getPortMode(); //if mode == send if (m == ImpulseSendPort){ QComboBox *param = new QComboBox(); for (int i=0; i< root->al->ParameterList.size(); i++) { param->addItem(root->al->ParameterList[i]->getName()); if (ip->getParameter() != NULL){ if (root->al->ParameterList[i]->getName().compare(ip->getParameter()->getName()) == 0) param->setCurrentIndex(i); } } for (int i=0; i< root->al->StateVariableList.size(); i++) { param->addItem(root->al->StateVariableList[i]->getName()); if (ip->getParameter() != NULL){ if (root->al->StateVariableList[i]->getName().compare(ip->getParameter()->getName()) == 0) param->setCurrentIndex(i); } } for (int i=0; i< root->al->AliasList.size(); i++) { param->addItem(root->al->AliasList[i]->getName()); if (ip->getParameter() != NULL){ if (root->al->AliasList[i]->getName().compare(ip->getParameter()->getName()) == 0) param->setCurrentIndex(i); } } if (ip->getParameter() == NULL) param->setCurrentIndex(-1); connect(param, SIGNAL(currentIndexChanged(QString)), ip, SLOT(setParameter(QString))); addRow(tr("&Par/Var:"),param); } //otherwise m == Recv else { QLineEdit *name = new QLineEdit(); name->installEventFilter(&eventFilterObject); name->setText(ip->getName()); name->setValidator(validator); connect(name, SIGNAL(textEdited(QString)), ip, SLOT(setName(QString))); addRow(tr("&Name:"),name); } QComboBox *mode = new QComboBox(); mode->addItem("Send"); mode->addItem("Receive"); switch(m){ case(ImpulseSendPort): mode->setCurrentIndex(0); break; case(ImpulseRecvPort): mode->setCurrentIndex(1); break; } connect(mode, SIGNAL(currentIndexChanged(QString)), ip, SLOT(setPortMode(QString))); addRow(tr("Impulse &Mode"), mode); if (m == ImpulseRecvPort){ QComboBox *dims_prefix = getPrefixCombo(ip->port->dims->getPrefix()); connect(dims_prefix, SIGNAL(currentIndexChanged(QString)), ip, SLOT(setDimsPrefix(QString))); addRow(tr("Dimensionality &Prefix:"),dims_prefix); QComboBox *dims_unit = getUnitCombo(ip->port->dims->getUnit()); connect(dims_unit, SIGNAL(currentIndexChanged(QString)), ip, SLOT(setDimsUnit(QString))); addRow(tr("Dimensionality &Unit:"),dims_unit); } }
void PropertiesManager::createAnalogPortProperties(AnalogPortTextItem *ap) { //move up down root->actionMove_Up->setEnabled(true); root->actionMove_Down->setEnabled(true); root->actionDeleteItems->setEnabled(true); QLabel *label = new QLabel("<b>Edit Analog Port</b>"); addRow(label); //if mode == send if (ap->getPortMode() == AnalogSendPort){ QComboBox *var = new QComboBox(); for (int i=0; i< root->al->StateVariableList.size(); i++) { var->addItem(root->al->StateVariableList[i]->getName()); if (ap->getVariable() != NULL){ if (root->al->StateVariableList[i]->getName().compare(ap->getVariable()->getName()) == 0) var->setCurrentIndex(i); } } for (int i=0; i< root->al->AliasList.size(); i++) { var->addItem(root->al->AliasList[i]->getName()); if (ap->getVariable() != NULL){ if (root->al->AliasList[i]->getName().compare(ap->getVariable()->getName()) == 0) var->setCurrentIndex(i+root->al->StateVariableList.size()); } } if (ap->getVariable() == NULL) var->setCurrentIndex(-1); connect(var, SIGNAL(currentIndexChanged(QString)), ap, SLOT(setVariable(QString))); addRow(tr("&Variable:"),var); } //otherwise else { QLineEdit *name = new QLineEdit(); name->installEventFilter(&eventFilterObject); name->setText(ap->getName()); name->setValidator(validator); connect(name, SIGNAL(textEdited(QString)), ap, SLOT(setName(QString))); addRow(tr("&Name:"),name); } QComboBox *mode = new QComboBox(); mode->addItem("Send"); mode->addItem("Receive"); mode->addItem("Reduce"); AnalogPortMode m = ap->getPortMode(); switch(m){ case(AnalogSendPort): mode->setCurrentIndex(0); break; case(AnalogRecvPort): mode->setCurrentIndex(1); break; case(AnalogReducePort): mode->setCurrentIndex(2); break; } connect(mode, SIGNAL(currentIndexChanged(QString)), ap, SLOT(setPortMode(QString))); addRow(tr("Analog &Mode"), mode); if(m == AnalogReducePort){ QComboBox *reduce = new QComboBox(); reduce->addItem("None"); reduce->addItem("Addition"); ReduceOperation r = ap->getPortReduceOp(); switch(r){ case(ReduceOperationNone): reduce->setCurrentIndex(0); break; case(ReduceOperationAddition): reduce->setCurrentIndex(1); break; } connect(reduce, SIGNAL(currentIndexChanged(QString)), ap, SLOT(setPortReduceOp(QString))); addRow(tr("&Reduce Operation:"), reduce); } if ((m == AnalogRecvPort)||(m == AnalogReducePort)){ QComboBox *dims_prefix = getPrefixCombo(ap->port->dims->getPrefix()); connect(dims_prefix, SIGNAL(currentIndexChanged(QString)), ap, SLOT(setDimsPrefix(QString))); addRow(tr("Dimensionality &Prefix:"),dims_prefix); QComboBox *dims_unit = getUnitCombo(ap->port->dims->getUnit()); connect(dims_unit, SIGNAL(currentIndexChanged(QString)), ap, SLOT(setDimsUnit(QString))); addRow(tr("Dimensionality &Unit:"),dims_unit); } }