예제 #1
0
bool PortParameters::SetBit(const char *pVal, const Bit &bit)
{
  if (!lstrcmpi(pVal, "*"))
    return TRUE;

  if (!lstrcmpi("-", pVal)) {
    if (maskExplicit & bit.bit) {
      maskExplicit &= ~bit.bit;
      maskChanged |= bit.bit;
    }
    return TRUE;
  }

  if (bit.type == Bit::FLAG) {
    if (!SetFlag(pVal, bit.bit))
      return FALSE;
  }
  else
  if (bit.type == Bit::PIN) {
    if (!SetPin(pVal, bit.bit))
      return FALSE;
  }
  else
  if (bit.type == Bit::PROBABILITY) {
    if (!SetProbability(pVal, bit.bit))
      return FALSE;
  }
  else
  if (bit.type == Bit::UNSIGNED) {
    if (!SetUnsigned(pVal, bit.bit))
      return FALSE;
  }
  else
  if (bit.type == Bit::OTHER) {
    if (bit.bit == m_portName) {
      if (!SetPortName(pVal))
        return FALSE;
    }
    else
    if (bit.bit == m_realPortName) {
      if (!SetRealPortName(pVal))
        return FALSE;
    }
    else {
      return FALSE;
    }
  }
  else {
    return FALSE;
  }

  if (maskChanged & bit.bit)
    maskExplicit |= bit.bit;

  return TRUE;
}
예제 #2
0
////////////////////////////////////////////////////////////////////////////
//
// Explicit start of port access
//
PortW32::PortAccessStatus PortW32::POpen(const wxPortDescr& portDevice)
{
	m_lastError = IPAC_Success;

   if (portDevice.PortIndex()<0) {
      m_lastError = IPAC_NoInterface;
      return m_lastError;
   }
   // just copy from descriptor
   SetPortParallel(portDevice.IsPortParallel());
   SetPortSerial(portDevice.IsPortSerial());
   SetPortGPUSB(portDevice.IsPortGPUSB());//BM:20081226 added
   SetPortLXUSB(portDevice.IsPortLXUSB());//BM:20081226 added
   SetPortLXLED(portDevice.IsPortLXLED());//BM:20081226 added
   SetPortDummy(portDevice.IsPortDummy());
   SetPortName(portDevice.PortName());
   SetPortPath(portDevice.PortPath());

   // depending on the port type we setup things here
   if (IsPortParallel()) {
      // regular parallel port - things have to be setup in the dialog
      // we support all 8 bits of the port
      m_portAddress = portDevice.PortAddress();
      SetNumbits(8); SetBitmask(0xff);
      SetPortOut(true); SetPortIn(false);
   }
   else if (IsPortSerial()) {
      // regular or virtual serial port - things have to be setup in the dialog
      // we support only RTS and DTR as port outputs, CTS and DTR as inputs (and RX and TX for data)
      m_comName.Printf(wxT("%s"), PortPath());
      SetNumbits(2); SetBitmask(0x3);
      SetPortOut(true); SetPortIn(true);
   }
   else if (IsPortGPUSB()) {
      // this port goes through an USB HID device from Shoestring via Win DLL
      // we support the 4 lines b0..b3 --> RA-, RA+, DEC-, DEC+ (LED is handled by the driver)
      SetNumbits(4); SetBitmask(0x0f);
      SetPortOut(true); SetPortIn(true);
   }
   else if (IsPortLXUSB()) {
      // this port goes through an USB HID device from Shoestring via Win DLL
      // we support the 4 lines b0..b3 --> Frame1, Frame2, Shutter, Amp (LED is handled by the driver)
      SetNumbits(4); SetBitmask(0x0f);
      SetPortOut(true); SetPortIn(true);
   }

   return POpen_Second(); // call real openport
}
예제 #3
0
/////////////////////////////////////////////////////////////////////////////
//
// Explicit start of port access
//
PortUX::PortAccessStatus PortUX::POpen(const wxPortDescr& portDevice)
{
	m_lastError = IPAC_Success;

   SetPortParallel(portDevice.IsPortParallel());
   SetPortSerial(portDevice.IsPortSerial());
   SetPortGPUSB(portDevice.IsPortGPUSB());//BM:20081226 added
   SetPortLXUSB(portDevice.IsPortLXUSB());//BM:20081226 added
   SetPortLXLED(portDevice.IsPortLXLED());//BM:20081226 added
   SetPortDummy(portDevice.IsPortDummy());
   SetPortName(portDevice.PortName());
   SetPortPath(portDevice.PortPath());

   if (IsPortParallel()) {
      SetNumbits(8); SetBitmask(0xff);
      SetPortOut(true); SetPortIn(false);
   }
   else if (IsPortSerial()) {
      SetNumbits(2); SetBitmask(0x3);
      SetPortOut(true); SetPortIn(true);
   }
   else if (IsPortGPUSB()) {
      // this port goes through an USB HID device from Shoestring via Win DLL
      // we support the 4 lines b0..b3 --> RA-, RA+, DEC-, DEC+ (LED is handled by the driver)
      SetNumbits(4); SetBitmask(0x0f);
      SetPortOut(true); SetPortIn(true);
   }
   else if (IsPortLXUSB()) {
      // this port goes through an USB HID device from Shoestring via Win DLL
      // we support the 4 lines b0..b3 --> Frame1, Frame2, Shutter, Amp (LED is handled by the driver)
      SetNumbits(4); SetBitmask(0x0f);
      SetPortOut(true); SetPortIn(true);
   }

   return POpen_Second(); // call real openport
}