/// <summary> /// Copy from Antenna /// </summary> /// <param name="from"></param> public void Copy(Antenna from) { this.port = from.Port; this.antennaStatus = (from.antennaStatus); this.antennaConfig = (from.antennaConfig); }
/// <summary> /// Constructor /// designed to init for loading from radio /// </summary> /// <param name="port">Valid port from 0 - 15</param> public AntennaStatus ( UInt32 port ) : base() { this.port = port; this.antennaPortStatus = new AntennaPortStatus(); }
private void GetAntennaPortStatus(int radioHandle) { AntennaPortStatus antennaPortStatus = new AntennaPortStatus(); var result = link.AntennaPortGetStatus(radioHandle, 0, antennaPortStatus); logger.Information("link.AntennaPortGetStatus => {Result}", result); logger.Information("\tRadioHandle used : " + radioHandle); logger.Information("\tLength found : " + antennaPortStatus.length); logger.Information("\tState found : " + antennaPortStatus.state); logger.Information("\tSense Value found : " + antennaPortStatus.antennaSenseValue); }
private void state_SelectedIndexChanged(object sender, EventArgs e) { AntennaPortStatus ant = new AntennaPortStatus(); AntennaPortConfig antCfg = new AntennaPortConfig(); if (state.SelectedIndex >= 0) { if (Program.ReaderXP.GetAntennaPortStatus((uint)state.SelectedIndex, ref ant) == Result.OK) { cb_enable.SelectedItem = ant.state; } if (Program.ReaderXP.GetAntennaPortConfiguration((uint)state.SelectedIndex, ref antCfg) == Result.OK) { txPhysicalPort.Text = antCfg.physicalTxPort.ToString(); rxPhysicalPort.Text = antCfg.physicalRxPort.ToString(); dwellTime.Value = antCfg.dwellTime; inventoryCycles.Value = antCfg.numberInventoryCycles; powerLevel.Value = antCfg.powerLevel; senseThreshold.Value = antCfg.antennaSenseThreshold; } } }
/// <summary> /// Constructor /// </summary> /// <param name="port"></param> /// <param name="state"></param> /// <param name="powerLevel"></param> /// <param name="dwellTime"></param> /// <param name="numberInventoryCycles"></param> /// <param name="antennaSenseThreshold"></param> public Antenna ( UInt32 port, AntennaPortState state, UInt32 powerLevel, UInt32 dwellTime, UInt32 numberInventoryCycles, Boolean easAlarm, Boolean enableLocalInv, SingulationAlgorithm invAlgo, UInt32 startQ, Boolean enableLocalProfile, UInt32 linkProfile, Boolean enableLocalFreq, UInt32 freqChannel, UInt32 antennaSenseThreshold ) : base() { this.port = port; this.antennaStatus = new AntennaPortStatus(); this.antennaConfig = new AntennaPortConfig(); this.State = state; this.EnableLocalFreq = enableLocalFreq; this.EASAlarm = easAlarm; this.EnableLocalInv = enableLocalInv; this.EnableLocalProfile = enableLocalProfile; this.InventoryAlgorithm = invAlgo; this.StartQ = startQ; this.LinkProfile = linkProfile; this.FreqChannel = freqChannel; this.PowerLevel = powerLevel; this.DwellTime = dwellTime; this.NumberInventoryCycles = numberInventoryCycles; this.AntennaSenseThreshold = antennaSenseThreshold; }
private void state_SelectedIndexChanged(object sender, EventArgs e) { AntennaPortStatus ant = new AntennaPortStatus(); AntennaPortConfig antCfg = new AntennaPortConfig(); if (state.SelectedIndex >= 0) { if (Program.ReaderXP.GetAntennaPortStatus((uint)state.SelectedIndex, ref ant) == Result.OK) { cb_enable.SelectedItem = ant.state; } if (Program.ReaderXP.GetAntennaPortConfiguration((uint)state.SelectedIndex, ref antCfg) == Result.OK) { txPhysicalPort.Text = antCfg.physicalTxPort.ToString(); rxPhysicalPort.Text = antCfg.physicalRxPort.ToString(); dwellTime.Value = antCfg.dwellTime; inventoryCycles.Value = antCfg.numberInventoryCycles; powerLevel.Value = antCfg.powerLevel; senseThreshold.Value = antCfg.antennaSenseThreshold; } } }
public Result AntennaPortGetStatus(uint port, AntennaPortStatus portStatus) { UInt32 registerValue = 0; // First, tell the MAC which antenna descriptors we'll be reading and // verify that it was a valid selector MacWriteRegister(MACREGISTER.HST_ANT_DESC_SEL, port); /* * MacReadRegister(MACREGISTER.MAC_ERROR, ref registerValue); * * if (registerValue == HOSTIF_ERR_SELECTORBNDS) * { * MacClearError(); * return Result.INVALID_PARAMETER; * } */ // Get the state of the antenna MacReadRegister(MACREGISTER.HST_ANT_DESC_CFG, ref registerValue); portStatus.state = ((registerValue & 0x01) != 0x00 ? AntennaPortState.ENABLED : AntennaPortState.DISABLED); portStatus.enableLocalInv = (registerValue & (1 << 1)) != 00; portStatus.inv_algo = (SingulationAlgorithm)(registerValue >> 2 & 0x03); portStatus.startQ = registerValue >> 4 & 0x0f; portStatus.enableLocalProfile = (registerValue & (1 << 8)) != 00; portStatus.profile = registerValue >> 9 & 0x0f; portStatus.enableLocalFreq = (registerValue & (1 << 13)) != 00; portStatus.freqChn = registerValue >> 14 & 0x3f; // Now read the anteanna sense value MacReadRegister(MACREGISTER.MAC_ANT_DESC_STAT, ref registerValue); portStatus.antennaSenseValue = registerValue; return(Result.OK); }
public static extern Result RFID_AntennaPortGetStatus ( [In] Int32 handle, [In] UInt32 port, [In, Out] AntennaPortStatus status );
public Result AntennaPortSetStatus(uint port, AntennaPortStatus portStatus) { UInt32 registerValue = 0; // First, tell the MAC which antenna descriptors we'll be reading and // verify that it was a valid selector MacWriteRegister(MACREGISTER.HST_ANT_DESC_SEL, port); /*MacReadRegister(MACREGISTER.MAC_ERROR, ref registerValue); * * if (registerValue == HOSTIF_ERR_SELECTORBNDS) * { * MacClearError(); * return Result.INVALID_PARAMETER; * } */ // Read the current value of the anteann port configuration MacReadRegister(MACREGISTER.HST_ANT_DESC_CFG, ref registerValue); registerValue &= 0xfff00000; // Now set the enabled bit appropriately switch (portStatus.state) { case AntennaPortState.DISABLED: { //HST_ANT_DESC_CFG_SET_DISABLED//(registerValue); registerValue &= ~((uint)1); break; } // case RFID_ANTENNA_PORT_STATE_DISABLED case AntennaPortState.ENABLED: { //HST_ANT_DESC_CFG_SET_ENABLED(registerValue); registerValue |= 1; break; } // case RFID_ANTENNA_PORT_STATE_ENABLED default: { return(Result.INVALID_PARAMETER); break; } // default } // switch (state) if (portStatus.easAlarm) { registerValue |= 1U << 20; } else { registerValue &= ~(1U << 20); } if (portStatus.enableLocalInv) { //HST_ANT_DESC_CFG_SET_LOCAL_INV(registerValue); //HST_ANT_DESC_CFG_SET_INV_ALGO(registerValue, pStatus->inv_algo); //HST_ANT_DESC_CFG_SET_STARTQ(registerValue, pStatus->startQ); registerValue |= 1 << 1; registerValue |= (uint)portStatus.inv_algo << 2; registerValue |= (uint)portStatus.startQ << 4; } else { //HST_ANT_DESC_CFG_SET_GLOBAL_INV(registerValue); registerValue &= ~((uint)1 << 1); } if (portStatus.enableLocalProfile) { //HST_ANT_DESC_CFG_SET_LOCAL_PROFILE(registerValue); //HST_ANT_DESC_CFG_SET_PROFILE(registerValue, pStatus->profile); registerValue |= (uint)1 << 8; registerValue |= (uint)portStatus.profile << 9; } else { //HST_ANT_DESC_CFG_SET_GLOBAL_PROFILE(registerValue); registerValue &= ~((uint)1 << 8); } if (portStatus.enableLocalFreq) { //HST_ANT_DESC_CFG_SET_LOCAL_FREQ(registerValue); //HST_ANT_DESC_CFG_SET_FREQ_CHN(registerValue, pStatus->freqChn); registerValue |= (uint)1 << 13; registerValue |= (uint)portStatus.freqChn << 14; } else { //HST_ANT_DESC_CFG_SET_GLOBAL_FREQ(registerValue); registerValue &= ~((uint)1 << 13); } // Write back the configuration register MacWriteRegister(MACREGISTER.HST_ANT_DESC_CFG, registerValue); return(Result.OK); }
/// <summary> /// Retrieves the status of the requested logical antenna port for a /// particular radio module. The antenna-port status cannot be /// retrieved while a radio module is executing a tag-protocol /// operation. /// </summary> /// <param name="port">antenna port</param> /// <param name="portStatus"></param> /// <returns></returns> public Result SetAntennaPortStatus(uint port, AntennaPortStatus portStatus) { m_AntennaList[(int)port].AntennaStatus = portStatus; return(m_Result = AntennaPortSetStatus(port, portStatus)); }
/// <summary> /// Retrieves the status of the requested logical antenna port for a /// particular radio module. The antenna-port status cannot be /// retrieved while a radio module is executing a tag-protocol /// operation. /// </summary> /// <param name="portStatus"></param> /// <returns></returns> public Result SetAntennaPortStatus(AntennaPortStatus portStatus) { return(m_Result = AntennaPortSetStatus(0, portStatus)); }
/// <summary> /// Retrieves the status of the requested logical antenna port for a /// particular radio module. The antenna-port status cannot be /// retrieved while a radio module is executing a tag-protocol /// operation. /// </summary> /// <param name="port">antenna port</param> /// <param name="portStatus"></param> /// <returns></returns> public Result GetAntennaPortStatus(uint port, AntennaPortStatus portStatus) { return(m_Result = AntennaPortGetStatus(port, portStatus)); }