📄 mprmsg.cs
字号:
//==========================================================================================
//
// WJ.MPR.Reader.MPRMsg
// Copyright (c) 2006, WJ Communications, Inc.
//
// This file defines the MPRMsg class.
// It also contains useful enums (Status, Opcodes, Errors, etc.)
//
//==========================================================================================
using System;
using System.Threading;
using System.Collections;
using WJ.MPR.Util;
namespace WJ.MPR.Reader
{
#region public message enums
/// <summary>
/// Message Command Opcodes
/// </summary>
public enum CmdCode : byte
{
/// <summary>
/// Unknown Command. Not a valid Command.
/// </summary>
unknown = 0x00,
/// <summary>
/// Requests the MPR Manufacturing Information
/// </summary>
ReaderInfo = 0x01,
/// <summary>
/// Exit Application and Launch Bootloader to Download a new FW Application.
/// </summary>
EnterBootloader = 0x05,
#region Class 0 commands
/// <summary>
/// Requests the Class 0 Inventory.
/// </summary>
Class0Read = 0x11,
/// <summary>
/// Kill Class 0 Tags.
/// </summary>
Class0Kill = 0x12,
/// <summary>
/// Command to access Class0 Zuma subcommands.
/// <see cref="Class0ZumaSubcommands"/>
/// </summary>
Class0ZumaCommands = 0x18,
/// <summary>
/// Lock a Class0+ (Matrics) ITM Page.
/// </summary>
Class0PlusLockPage = 0x1a,
/// <summary>
/// Erase a Class0+ (Matrics) ITM Page.
/// </summary>
Class0PlusErasePage = 0x1b,
/// <summary>
/// Read Class 0+ (Matrics) Tag Data.
/// </summary>
Class0PlusRead = 0x1c,
/// <summary>
/// Write Class 0+ (Matrics) Tag Data.
/// </summary>
Class0PlusWrite = 0x1d,
/// <summary>
/// Class 0+ (Matrics) global Read.
/// </summary>
Class0PlusGlobalRead = 0x1e,
/// <summary>
/// Program Class 0+ (Matrics) EPC.
/// </summary>
Class0PlusProgram = 0x1f,
#endregion
#region Class 1 commands
/// <summary>
/// Requests the Class 1 Inventory.
/// </summary>
Class1Read = 0x21,
/// <summary>
/// Kill Class 1 Tags.
/// </summary>
Class1Kill = 0x22,
/// <summary>
/// A Class1 Programming Command.
/// Write 16 bits to a Class 1 Tag Data.
/// </summary>
Class1Write = 0x23,
/// <summary>
/// A Class1 Programming Command.
/// Verify a Class1 Tag.
/// Reads and returns all data on tag, EPC and CRC.
/// </summary>
Class1IDVerify = 0x24,
/// <summary>
/// A Class1 Programming Command.
/// Erase Tags.
/// </summary>
Class1IDErase = 0x25,
/// <summary>
/// Attempt to read a Single Class1 Tag.
/// </summary>
Class1ReadSingleTag = 0x26,
/// <summary>
/// Request the Class 1 inventory using the Ping Algorithm.
/// (Deprecated, please use Class1Read, 0x21)
/// </summary>
Class1ReadTagsWP = 0x27,
/// <summary>
/// Integrated Class 1 Tag ID Program Command.
/// </summary>
Class1ProgramID = 0x28,
#endregion
#region Gen 2 command
/// <summary>
/// All Gen2 commands use this opcode
/// </summary>
Gen2Command = 0x60,
#endregion
/// <summary>
/// Set and Get the values of the GPIO pins
/// </summary>
GPIO = 0x45,
}
/// <summary>
/// These are the subcommands for Impinj Zuma (Re-writeable Class 0), command 0x18
/// </summary>
public enum Class0ZumaSubcommands : byte
{
/// <summary>
/// Write a Row (18 bits) to a Zuma Tag.
/// </summary>
WriteRow = 0x00,
/// <summary>
/// Read a Row (18 bits) from a Zuma Tag.
/// </summary>
ReadRow = 0x01,
/// <summary>
/// Initialize a Zuma Tag for re-writing.
/// This RF-interface command sets the Fab Protect row to Golden Word.
/// </summary>
INIT = 0x02,
/// <summary>
/// Write a Row (18 bits) to a Zuma Tag, and wait for an acknowledgement.
/// Singulated-only command.
/// </summary>
WriteAck = 0x03,
/// <summary>
/// Program an EPC, CRC and Kill Passcode into a Zuma Tag
/// </summary>
ProgramEPC = 0x05
}
/// <summary>
/// These are the subcommands for Gen 2 Class 1, command 0x60
/// </summary>
public enum Gen2Subcommands : byte
{
/// <summary>
///
/// </summary>
Inventory = 0x01,
/// <summary>
///
/// </summary>
SelectAdd = 0x10,
/// <summary>
///
/// </summary>
SelectRemove = 0x011,
/// <summary>
///
/// </summary>
SelectRead = 0x12,
/// <summary>
///
/// </summary>
Read = 0x20,
/// <summary>
///
/// </summary>
Write = 0x21,
/// <summary>
///
/// </summary>
Erase = 0x22,
/// <summary>
///
/// </summary>
Lock = 0x23,
/// <summary>
///
/// </summary>
Kill = 0x24
}
/// <summary>
/// These are the settings for the option parameter of
/// the ZumaProgramEPC subcommand
/// </summary>
[Flags]
public enum ZumaProgramOptions : byte
{
/// <summary>
/// No options set
/// </summary>
None = 0x00,
/// <summary>
/// 0b-------1 Ensure an invalid EPC and CRC before programming
/// </summary>
CheckEPC = 0x01,
/// <summary>
/// 0b------1- Set (1) the Fab Protect Lock Bit during INIT
/// </summary>
LockFP = 0x02,
/// <summary>
/// 0b-----1-- Lock the EPC, CRC and Control Word rows
/// </summary>
LockEPC = 0x04,
/// <summary>
/// 0b----1--- Program the Kill Passcode
/// </summary>
ProgramKill = 0x08,
/// <summary>
/// 0b---1---- Lock the Kill Passcode
/// </summary>
LockKill = 0x10
}
/// <summary>
/// Command Response Status Codes.
/// These are the Status bytes from Response Frames (or Packets).
/// </summary>
public enum StatusCode : byte
{
/// <summary>
/// MPR reports an Error.
/// </summary>
Error = 0xff,
/// <summary>
/// MPR complete the request.
/// This is the last response frame.
/// </summary>
Complete = 0x00,
/// <summary>
/// This is not the last response frame;
/// More frames will follow.
/// </summary>
InProgress = 0x01,
/// <summary>
/// Status Code could not be determined from a response frame.
/// </summary>
unknown
}
/// <summary>
/// Command Response Error Codes.
/// These Error Codes follow the Status Byte in Frames
/// with a Status Byte = 0xff (StatusCode.Error)
/// <see cref="StatusCode"/>
/// </summary>
public enum ErrorCode : byte
{
/// <summary>
/// No error reported.
/// This is not received from the MPR, but inferred for Frames with non-Error statuses.
/// </summary>
NoError,
/// <summary>
/// Another Select Record cannot be added to the Select List because it is full.
/// </summary>
Gen2SelectListFull = 0xA1,
/// <summary>
/// Cannot remove requested Select Record because an invalid Index was provided.
/// </summary>
Gen2UnknownSelectRecord = 0xA2,
/// <summary>
/// Internal Error while Performing Class1 Tree Walk Algorithm.
/// </summary>
PingMaskOverflow = 0xDA,
/// <summary>
/// Internal Error while Performing Class1 Tree Walk Algorithm.
/// </summary>
PingMaskNegativeShift = 0xDB,
/// <summary>
/// Internal Error while Performing Class1 Tree Walk Algorithm.
/// </summary>
PingJobOverflow = 0xDC,
/// <summary>
/// MPR Current Sense ADC reports out-of-range condition.
/// </summary>
CurrentOutOfRange = 0xDD,
/// <summary>
/// MPR Voltage Sense ADC reports out-of-range condition.
/// </summary>
VoltageOutOfRange = 0xDE,
/// <summary>
/// MPR Could not verify the CRC of the Application Header.
/// </summary>
AppHeaderAccessError = 0xDF,
/// <summary>
/// Error Programming page (EPC Class 0+ tags only)
/// </summary>
Class0PlusErrorErasingPage = 0xE0,
/// <summary>
/// Error Erasing page (EPC Class 0+ tags only)
/// </summary>
Class0PlusErrorProgrammingPage = 0xE1,
/// <summary>
/// Error Programming Traversal Inhibit Bit (EPC Class 0+ tags only)
/// </summary>
Class0PlusErrorProgrammingTIB = 0xE2,
/// <summary>
/// Error Locking page (EPC Class 0+ tags only)
/// </summary>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -