### Start RFID Tag Inventory Operation Source: https://context7.com/cslrfid/cslibrary/llms.txt Launches an RFID inventory operation. Subscribe to OnAsyncCallback for tag results and OnStateChanged for operation status. Ensure the RFIDReader instance is properly initialized. ```csharp using CSLibrary; using CSLibrary.Constants; using CSLibrary.Events; RFIDReader rfid = reader.rfid; // Subscribe to inventory results rfid.OnAsyncCallback += (sender, e) => { if (e.type == CallbackType.TAG_RANGING) { var tag = e.info; Console.WriteLine($"EPC: {tag.epc} RSSI: {tag.rssi} dBm Antenna: {tag.antennaPort}"); } }; // Subscribe to operation state changes rfid.OnStateChanged += (sender, e) => { Console.WriteLine($"RFID state: {e.state}"); // RFState.IDLE, BUSY, ABORT, etc. }; // Start a continuous inventory Result result = rfid.StartOperation(Operation.TAG_RANGING); if (result != Result.OK) Console.WriteLine("Failed to start inventory: " + result); ``` -------------------------------- ### RFID Singulation Algorithm Functions Source: https://github.com/cslrfid/cslibrary/blob/main/CSLibrary2024/Readme.txt Functions to set and get the current singulation algorithm. ```APIDOC ## SetCurrentSingulationAlgorithm ### Description Sets the current singulation algorithm for tag detection. ### Method Set ### Endpoint RFID/Singulation/Algorithm ### Parameters #### Request Body - **SingulationAlgorithm** (SingulationAlgorithm) - Required - The singulation algorithm to set ``` ```APIDOC ## GetCurrentSingulationAlgorithm ### Description Gets the current singulation algorithm being used. ### Method Get ### Endpoint RFID/Singulation/Algorithm/Current ### Parameters #### Query Parameters - **SingulationAlgorithm** (ref SingulationAlgorithm) - Required - Output parameter for the current singulation algorithm ### Response #### Success Response (200) - **Result**: Operation result ``` -------------------------------- ### Configure RFID Operation Parameters Source: https://context7.com/cslrfid/cslibrary/llms.txt Sets various parameters for RFID operations using the Options property and specific configuration methods before starting an operation. This includes tag selection, session, target, power, and inventory duration. ```csharp using CSLibrary; using CSLibrary.Constants; using CSLibrary.Structures; RFIDReader rfid = reader.rfid; // Configure inventory parameters rfid.Options.TagRanging.flags = SelectFlags.SELECT; rfid.Options.TagRanging.multibanks = 0; // Set session and target group rfid.SetTagGroup(Selected.ALL, Session.S0, SessionTarget.A); // Set power level (unit: 0.1 dBm, e.g. 300 = 30.0 dBm) rfid.SetPowerLevel(300); // Set inventory duration per antenna port (milliseconds) rfid.SetInventoryDuration(1000, antennaPort: 0); // Start operation rfid.StartOperation(Operation.TAG_RANGING); ``` -------------------------------- ### BarcodeReader.Start() / Stop() + OnCapturedNotify Source: https://context7.com/cslrfid/cslibrary/llms.txt This snippet explains how to control the integrated barcode scanner using the BarcodeReader class. It covers starting and stopping the scanner, and receiving decoded barcodes via the OnCapturedNotify event. ```APIDOC ## BarcodeReader.Start() / Stop() + OnCapturedNotify — Barcode Scanning `BarcodeReader` controls the integrated 1D/2D barcode scanner in CS108/CS710S devices. Scanning runs continuously between `Start()` and `Stop()`, with each decoded barcode delivered via the `OnCapturedNotify` event. ```csharp using CSLibrary; using CSLibrary.Barcode; using CSLibrary.Barcode.Structures; BarcodeReader bc = reader.barcode; // Subscribe to barcode decode events bc.OnCapturedNotify += (sender, e) => { if (e.MessageType == MessageType.DEC_MSG) { var msg = (DecodeMessage)e.Message; Console.WriteLine($"Barcode: {msg.pchMessage}"); } }; // Check hardware availability if (bc.state == BarcodeReader.STATE.READY) { bc.Start(); // begin continuous scan // Optional: trigger haptic feedback on scan bc.VibratorOn(BarcodeReader.VIBRATORMODE.BAROCDEGOODREAD, time: 200); // 200 ms // ... wait for scans ... bc.Stop(); // stop scanning bc.VibratorOff(); } // Enable fast barcode mode for high-speed scanning bc.FastBarcodeMode(enable: true); ``` ``` -------------------------------- ### RFID Operation Commands Source: https://github.com/cslrfid/cslibrary/blob/main/CSLibrary2024/Readme.txt Commands to start and stop RFID operations. ```APIDOC ## StartOperation ### Description Starts a special RFID operation. ### Method Start ### Endpoint Operation/Start ### Parameters #### Request Body - **opertion** (Operation) - Required - The type of operation to start (e.g., TAG_RANGING, TAG_READ) ### Response #### Success Response (200) - **Result**: Operation result ``` ```APIDOC ## StopOperation ### Description Stops the current continuous inventory operation. ### Method Stop ### Endpoint Operation/Stop ### Response #### Success Response (200) - **void**: No return value ``` -------------------------------- ### Retrieve RFID Reader Identification Information Source: https://context7.com/cslrfid/cslibrary/llms.txt Get the reader's hardware model, firmware version string, OEM country code, and PCB assembly code after establishing a connection. Also retrieves the CSLibrary version. ```csharp using CSLibrary; using CSLibrary.Constants; using static CSLibrary.RFIDDEVICE; RFIDReader rfid = reader.rfid; // Get model MODEL model = rfid.GetModel(); Console.WriteLine($"Model: {model}"); // MODEL.CS710S or MODEL.CS108 // Get firmware version string fw = rfid.GetFirmwareVersionString(); Console.WriteLine($"Firmware: {fw}"); // Get OEM country code uint countryCode = rfid.GetCountry(); Console.WriteLine($"Country code: {countryCode}"); // Get PCB assembly code string pcb = rfid.GetPCBAssemblyCode(); Console.WriteLine($"PCB: {pcb}"); // Library version Version libVer = reader.GetVersion(); Console.WriteLine($"Library version: {libVer}"); // 2.0.10.1 ``` -------------------------------- ### Barcode Scanning with BarcodeReader Source: https://context7.com/cslrfid/cslibrary/llms.txt Control the integrated barcode scanner using Start() and Stop() methods. Decoded barcodes are delivered via the OnCapturedNotify event. Fast barcode mode can be enabled for high-speed scanning. ```csharp using CSLibrary; using CSLibrary.Barcode; using CSLibrary.Barcode.Structures; BarcodeReader bc = reader.barcode; // Subscribe to barcode decode events bc.OnCapturedNotify += (sender, e) => { if (e.MessageType == MessageType.DEC_MSG) { var msg = (DecodeMessage)e.Message; Console.WriteLine($"Barcode: {msg.pchMessage}"); } }; // Check hardware availability if (bc.state == BarcodeReader.STATE.READY) { bc.Start(); // begin continuous scan // Optional: trigger haptic feedback on scan bc.VibratorOn(BarcodeReader.VIBRATORMODE.BAROCDEGOODREAD, time: 200); // 200 ms // ... wait for scans ... bc.Stop(); // stop scanning bc.VibratorOff(); } // Enable fast barcode mode for high-speed scanning bc.FastBarcodeMode(enable: true); ``` -------------------------------- ### RFID Operation Types Source: https://github.com/cslrfid/cslibrary/blob/main/CSLibrary2024/Readme.txt Defines the types of operations that can be started. ```APIDOC ## Operation Enum ### Description Enumeration of possible RFID operations. ### Values - **TAG_RANGING**: Start Inventory - **TAG_SELECTED**: Set Selected Tag parameter - **TAG_PREFILTER**: Set Pre-Filter - **TAG_READ**: Start to read - **TAG_READ_PC**: Start to read PC - **TAG_READ_EPC**: Start to read EPC - **TAG_READ_ACC_PWD**: Start to read access password - **TAG_READ_KILL_PWD**: Start to read kill password - **TAG_READ_TID**: Start to read TID bank data - **TAG_READ_USER**: Start to reader USER bank data - **TAG_WRITE**: Start to Write - **TAG_WRITE_PC**: Start to Write PC - **TAG_WRITE_EPC**: Start to Write EPC - **TAG_WRITE_ACC_PWD**: Start to Write access password - **TAG_WRITE_KILL_PWD**: Start to Write kill password - **TAG_WRITE_USER**: Start to Write USER bank data - **TAG_LOCK**: Set Tag Lock - **TAG_BLOCK_PERMALOCK**: Set Tag Block Permalock ``` -------------------------------- ### HighLevelInterface Initialization and Event Handling Source: https://context7.com/cslrfid/cslibrary/llms.txt Demonstrates how to instantiate the HighLevelInterface, subscribe to reader state change events, and access sub-handlers for RFID, barcode, and battery functionalities. ```APIDOC ## HighLevelInterface Initialization and Event Handling ### Description Instantiate the top-level interface for reader control and subscribe to connection status events. Access sub-handlers for specific functionalities like RFID and barcode scanning. ### Usage ```csharp using CSLibrary; using CSLibrary.Constants; using CSLibrary.Events; // Instantiate the top-level interface (CSLibrary2024 / BLE variant) HighLevelInterface reader = new HighLevelInterface(); // Subscribe to reader connection state changes reader.OnReaderStateChanged += (sender, e) => { switch (e.type) { case ReaderCallbackType.CONNECT_SUCESS: Console.WriteLine("Reader connected: " + reader.ReaderName); break; case ReaderCallbackType.CONNECTION_LOST: Console.WriteLine("Reader connection lost."); break; case ReaderCallbackType.COMMUNICATION_ERROR: Console.WriteLine("Communication error."); break; } }; // Access sub-handlers RFIDReader rfid = reader.rfid; BarcodeReader bc = reader.barcode; Battery battery = reader.battery; ``` ``` -------------------------------- ### Initialize HighLevelInterface and Handle Reader State Changes Source: https://context7.com/cslrfid/cslibrary/llms.txt Instantiate the top-level interface for a reader and subscribe to connection state changes. This is the entry point for interacting with the reader and its sub-handlers. ```csharp using CSLibrary; using CSLibrary.Constants; using CSLibrary.Events; // Instantiate the top-level interface (CSLibrary2024 / BLE variant) HighLevelInterface reader = new HighLevelInterface(); // Subscribe to reader connection state changes reader.OnReaderStateChanged += (sender, e) => { switch (e.type) { case ReaderCallbackType.CONNECT_SUCESS: Console.WriteLine("Reader connected: " + reader.ReaderName); break; case ReaderCallbackType.CONNECTION_LOST: Console.WriteLine("Reader connection lost."); break; case ReaderCallbackType.COMMUNICATION_ERROR: Console.WriteLine("Communication error."); break; } }; // Access sub-handlers RFIDReader rfid = reader.rfid; BarcodeReader bc = reader.barcode; Battery battery = reader.battery; ``` -------------------------------- ### Operation Control Source: https://github.com/cslrfid/cslibrary/blob/main/CSLibraryBT/Readme.txt Functions to start and stop RFID operations. ```APIDOC ## Start Operation ### Description Initiates a specific RFID operation. ### Method POST ### Endpoint /rfid/operation/start ### Parameters #### Request Body - **operation** (Operation) - Required - The type of operation to start (e.g., TAG_RANGING, TAG_READ). ### Request Example ```json { "operation": "TAG_RANGING" } ``` ### Response #### Success Response (200) - **result** (Result) - Indicates success or failure of the operation. ### Response Example ```json { "result": "SUCCESS" } ``` ## Stop Operation ### Description Stops the current continuous inventory operation. ### Method POST ### Endpoint /rfid/operation/stop ### Response #### Success Response (200) - **result** (Result) - Indicates success or failure of the operation. ### Response Example ```json { "result": "SUCCESS" } ``` ``` -------------------------------- ### Configure RFID Reader Singulation Algorithms Source: https://context7.com/cslrfid/cslibrary/llms.txt Selects and configures the anti-collision algorithm. DYNAMICQ is recommended for variable tag populations, while FIXEDQ is suitable for known tag counts. Read back the current algorithm to verify. ```csharp using CSLibrary; using CSLibrary.Constants; using CSLibrary.Structures; RFIDReader rfid = reader.rfid; // Use Dynamic-Q (recommended for variable tag populations) rfid.SetCurrentSingulationAlgorithm(SingulationAlgorithm.DYNAMICQ); rfid.SetDynamicQParms( StartQValue: 4, // Starting Q MinQValue: 0, // Minimum Q MaxQValue: 15, // Maximum Q ToggleTarget: 1 // Toggle A/B after each round ); // Or use Fixed-Q (for small known tag counts) rfid.SetCurrentSingulationAlgorithm(SingulationAlgorithm.FIXEDQ); rfid.SetFixedQParms( QValue: 4, // Fixed Q (2^4 = 16 slots) ToggleTarget: 0 // No target toggling ); // Read back algorithm in use SingulationAlgorithm current = SingulationAlgorithm.DYNAMICQ; rfid.GetCurrentSingulationAlgorithm(ref current); Console.WriteLine($"Active algorithm: {current}"); ``` -------------------------------- ### Q Parameter Management Source: https://github.com/cslrfid/cslibrary/blob/main/CSLibraryBT/Readme.txt Functions for configuring Fixed Q and Dynamic Q parameters. ```APIDOC ## Set Fixed Q Parameters ### Description Configures the parameters for the Fixed Q singulation algorithm. ### Method POST ### Endpoint /rfid/singulation/q/fixed ### Parameters #### Request Body - **fixedQParm** (FixedQParms) - Required - The fixed Q parameters. ### Request Example ```json { "retryCount": 5, "qValue": 4 } ``` ### Response #### Success Response (200) - **result** (Result) - Indicates success or failure of the operation. ### Response Example ```json { "result": "SUCCESS" } ``` ## Get Fixed Q Parameters ### Description Retrieves the current Fixed Q parameters. ### Method GET ### Endpoint /rfid/singulation/q/fixed ### Response #### Success Response (200) - **fixedQ** (FixedQParms) - The current fixed Q parameters. ### Response Example ```json { "retryCount": 5, "qValue": 4 } ``` ## Set Dynamic Q Parameters ### Description Configures the parameters for the Dynamic Q singulation algorithm. ### Method POST ### Endpoint /rfid/singulation/q/dynamic ### Parameters #### Request Body - **dynParm** (DynamicQParms) - Required - The dynamic Q parameters. ### Request Example ```json { "minQValue": 0, "maxQValue": 15, "stepQValue": 1, "retryCount": 10, "qExponent": 1 } ``` ### Response #### Success Response (200) - **result** (Result) - Indicates success or failure of the operation. ### Response Example ```json { "result": "SUCCESS" } ``` ## Get Dynamic Q Parameters ### Description Retrieves the current Dynamic Q parameters. ### Method GET ### Endpoint /rfid/singulation/q/dynamic ### Response #### Success Response (200) - **parms** (DynamicQParms) - The current dynamic Q parameters. ### Response Example ```json { "minQValue": 0, "maxQValue": 15, "stepQValue": 1, "retryCount": 10, "qExponent": 1 } ``` ``` -------------------------------- ### Power Level Management Source: https://github.com/cslrfid/cslibrary/blob/main/CSLibraryBT/Readme.txt Functions to get and set the power level of the RFID reader. ```APIDOC ## Get Max Power Level ### Description Gets the maximum power level the reader can operate at. ### Method GET ### Endpoint /rfid/power/max ### Response #### Success Response (200) - **powerLevel** (uint) - The maximum power level. ### Response Example ```json { "powerLevel": 3000 } ``` ## Get Current Power Level ### Description Gets the current power level the reader is set to. ### Method GET ### Endpoint /rfid/power/current ### Response #### Success Response (200) - **powerLevel** (uint) - The current power level. ### Response Example ```json { "powerLevel": 2700 } ``` ## Set Power Level ### Description Sets the power level for the RFID reader. ### Method POST ### Endpoint /rfid/power ### Parameters #### Request Body - **powerLevel** (uint) - Required - The desired power level to set. ### Request Example ```json { "powerLevel": 2500 } ``` ### Response #### Success Response (200) - **result** (Result) - Indicates success or failure of the operation. ### Response Example ```json { "result": "SUCCESS" } ``` ``` -------------------------------- ### Anti-Collision Algorithms Source: https://context7.com/cslrfid/cslibrary/llms.txt Selects and configures the singulation (anti-collision) algorithm. Supports Dynamic-Q for automatic optimization and Fixed-Q for controlled environments. ```APIDOC ## RFIDReader.SetCurrentSingulationAlgorithm() / RFIDReader.SetDynamicQParms() / RFIDReader.SetFixedQParms() — Anti-Collision Algorithms Selects and configures the singulation (anti-collision) algorithm used during inventory. `DYNAMICQ` automatically adjusts the Q parameter to optimize throughput; `FIXEDQ` uses a fixed slot count and is useful for known tag counts or controlled environments. ### Method - `SetCurrentSingulationAlgorithm(algorithm)`: Sets the active singulation algorithm. - `SetDynamicQParms(StartQValue, MinQValue, MaxQValue, ToggleTarget)`: Configures parameters for the Dynamic-Q algorithm. - `SetFixedQParms(QValue, ToggleTarget)`: Configures parameters for the Fixed-Q algorithm. - `GetCurrentSingulationAlgorithm(ref current)`: Reads back the currently active algorithm. ### Parameters #### `SetCurrentSingulationAlgorithm` Parameters - **algorithm** (SingulationAlgorithm) - The algorithm to set (DYNAMICQ or FIXEDQ). #### `SetDynamicQParms` Parameters - **StartQValue** (int) - The starting Q value. - **MinQValue** (int) - The minimum Q value. - **MaxQValue** (int) - The maximum Q value. - **ToggleTarget** (int) - Controls toggling between targets (e.g., 1 to toggle, 0 for no toggle). #### `SetFixedQParms` Parameters - **QValue** (int) - The fixed Q value (determines slot count: 2^QValue). - **ToggleTarget** (int) - Controls toggling between targets (e.g., 0 for no toggle). ### Request Example ```csharp using CSLibrary; using CSLibrary.Constants; using CSLibrary.Structures; RFIDReader rfid = reader.rfid; // Use Dynamic-Q (recommended for variable tag populations) rfid.SetCurrentSingulationAlgorithm(SingulationAlgorithm.DYNAMICQ); rfid.SetDynamicQParms( StartQValue: 4, // Starting Q MinQValue: 0, // Minimum Q MaxQValue: 15, // Maximum Q ToggleTarget: 1 // Toggle A/B after each round ); // Or use Fixed-Q (for small known tag counts) rfid.SetCurrentSingulationAlgorithm(SingulationAlgorithm.FIXEDQ); rfid.SetFixedQParms( QValue: 4, // Fixed Q (2^4 = 16 slots) ToggleTarget: 0 // No target toggling ); // Read back algorithm in use SingulationAlgorithm current = SingulationAlgorithm.DYNAMICQ; rfid.GetCurrentSingulationAlgorithm(ref current); Console.WriteLine($"Active algorithm: {current}"); ``` ``` -------------------------------- ### RFID Power Level Functions Source: https://github.com/cslrfid/cslibrary/blob/main/CSLibrary2024/Readme.txt Functions to get and set the RFID reader's power level. ```APIDOC ## GetActiveMaxPowerLevel ### Description Gets the maximum power level supported by the RFID reader. ### Method Get ### Endpoint RFID/PowerLevel/Max ### Response #### Success Response (200) - **uint**: Maximum power level ``` ```APIDOC ## GetPowerLevel ### Description Gets the current power level of the RFID reader. ### Method Get ### Endpoint RFID/PowerLevel/Current ### Parameters #### Query Parameters - **pwrlvl** (ref uint) - Required - Output parameter for the current power level ### Response #### Success Response (200) - **Result**: Operation result ``` ```APIDOC ## SetPowerLevel ### Description Sets the power level of the RFID reader. ### Method Set ### Endpoint RFID/PowerLevel ### Parameters #### Request Body - **pwrlevel** (UInt32) - Required - The desired power level ``` -------------------------------- ### CSLibrary.rfid Properties Source: https://github.com/cslrfid/cslibrary/blob/main/CSLibraryBT/Readme.txt Properties to get information about the current RFID channel, region code, and hopping channel status. ```APIDOC ## SelectedChannel ### Description Gets the currently selected channel for RFID operations. ### Property Type `uint` ``` ```APIDOC ## SelectedRegionCode ### Description Gets the current selected region code for RFID operations. ### Property Type `RegionCode` ``` ```APIDOC ## IsHoppingChannelOnly ### Description Indicates whether the reader is configured to only hop channels. ### Property Type `bool` ``` -------------------------------- ### RFIDReader.Options Source: https://context7.com/cslrfid/cslibrary/llms.txt Accesses configurable parameters for RFID operations, including inventory duration, power, select criteria, and tag group settings. These options should be set before calling StartOperation. ```APIDOC ## RFIDReader.Options (CSLibraryOperationParms) ### Description The `Options` property on `RFIDReader` holds all configurable parameters for RFID operations (inventory duration, power, select criteria, tag group, etc.). Set the relevant fields before calling `StartOperation`. ### Usage Access and modify fields within the `Options` object before initiating an RFID operation. ### Example ```csharp using CSLibrary; using CSLibrary.Constants; using CSLibrary.Structures; RFIDReader rfid = reader.rfid; // Configure inventory parameters rfid.Options.TagRanging.flags = SelectFlags.SELECT; rfid.Options.TagRanging.multibanks = 0; // Set session and target group rfid.SetTagGroup(Selected.ALL, Session.S0, SessionTarget.A); // Set power level (unit: 0.1 dBm, e.g. 300 = 30.0 dBm) rfid.SetPowerLevel(300); // Set inventory duration per antenna port (milliseconds) rfid.SetInventoryDuration(1000, antennaPort: 0); // Start operation rfid.StartOperation(Operation.TAG_RANGING); ``` ``` -------------------------------- ### RFIDReader.StartOperation() Source: https://context7.com/cslrfid/cslibrary/llms.txt Launches an RFID operation such as inventory, tag read, or tag write. The operation type is specified by the Operation enum, and results are returned asynchronously via events. ```APIDOC ## RFIDReader.StartOperation() ### Description Launches an RFID operation (inventory, tag read, tag write, etc.) on the reader. The operation type is specified by the `Operation` enum. Results are returned asynchronously via the `OnAsyncCallback` (for inventory) or `OnAccessCompleted` (for read/write/lock/kill) events. ### Method `RFIDReader.StartOperation(Operation operation)` ### Parameters #### Path Parameters - **operation** (Operation) - Required - The type of RFID operation to start (e.g., `Operation.TAG_RANGING`). ### Request Example ```csharp using CSLibrary; using CSLibrary.Constants; RFIDReader rfid = reader.rfid; // Start a continuous inventory Result result = rfid.StartOperation(Operation.TAG_RANGING); if (result != Result.OK) Console.WriteLine("Failed to start inventory: " + result); ``` ### Response #### Success Response (Result.OK) Indicates the operation was successfully started. #### Error Response Returns a `Result` enum value indicating the failure reason (e.g., `Result.READER_BUSY`). ``` -------------------------------- ### RFIDReader.GetFirmwareVersionString() / GetModel() Source: https://context7.com/cslrfid/cslibrary/llms.txt Retrieve device identification details including firmware version, hardware model, country code, and PCB assembly code. ```APIDOC ## RFIDReader.GetFirmwareVersionString() / GetModel() ### Description Retrieves device identification details after a successful connection: firmware version string and hardware model enum. ### Method `GetFirmwareVersionString()` `GetModel()` `GetCountry()` `GetPCBAssemblyCode()` `GetVersion()` (from HighLevelInterface) ### Parameters None ### Response #### Success Response - **GetFirmwareVersionString()**: Returns a string representing the firmware version. - **GetModel()**: Returns a `MODEL` enum value (e.g., `MODEL.CS710S`, `MODEL.CS108`). - **GetCountry()**: Returns a uint representing the OEM country code. - **GetPCBAssemblyCode()**: Returns a string representing the PCB assembly code. - **GetVersion()**: Returns a `Version` object representing the library version. ### Request Example ```csharp using CSLibrary; using CSLibrary.Constants; using static CSLibrary.RFIDDEVICE; RFIDReader rfid = reader.rfid; // Get model MODEL model = rfid.GetModel(); Console.WriteLine($"Model: {model}"); // MODEL.CS710S or MODEL.CS108 // Get firmware version string fw = rfid.GetFirmwareVersionString(); Console.WriteLine($"Firmware: {fw}"); // Get OEM country code uint countryCode = rfid.GetCountry(); Console.WriteLine($"Country code: {countryCode}"); // Get PCB assembly code string pcb = rfid.GetPCBAssemblyCode(); Console.WriteLine($"PCB: {pcb}"); // Library version Version libVer = reader.GetVersion(); Console.WriteLine($"Library version: {libVer}"); // 2.0.10.1 ``` ``` -------------------------------- ### Connect and Disconnect BLE Reader using ConnectAsync Source: https://context7.com/cslrfid/cslibrary/llms.txt Initiate an asynchronous BLE connection to a discovered device using its native information. Handle the connection success event and disconnect gracefully. ```csharp using CSLibrary; HighLevelInterface reader = new HighLevelInterface(); reader.OnReaderStateChanged += (sender, e) => { if (e.type == CSLibrary.Constants.ReaderCallbackType.CONNECT_SUCESS) { Console.WriteLine($"Connected. MAC: {reader.GetMacAddress()}"); Console.WriteLine($"Reader state: {reader.Status}"); // READERSTATE.IDLE } }; // Connect using native device information from DeviceFinder var deviceInfo = DeviceFinder.GetDeviceInformation("CS710S_001234"); // by name await reader.ConnectAsync(deviceInfo.nativeDeviceInformation); // ... use reader ... // Disconnect await reader.DisconnectAsync(); ``` -------------------------------- ### Write Tag Memory (EPC/User) with OnAccessCompleted Source: https://context7.com/cslrfid/cslibrary/llms.txt Perform tag memory writes to EPC or User memory banks using TagWriteEpcParms or TagWriteUserParms. Results are reported via the OnAccessCompleted event. ```csharp using CSLibrary; using CSLibrary.Constants; using CSLibrary.Events; using CSLibrary.Structures; RFIDReader rfid = reader.rfid; // Subscribe to write completion rfid.OnAccessCompleted += (sender, e) => { if (e.success && e.access == TagAccess.WRITE) Console.WriteLine("Write succeeded."); else Console.WriteLine($"Write failed: {e.bank}"); }; // Write a new EPC: "E2003412012345678900AABB" (12 bytes = 6 words) rfid.Options.TagWriteEpc.accessPassword = 0x00000000; rfid.Options.TagWriteEpc.offset = 0; rfid.Options.TagWriteEpc.count = 6; rfid.Options.TagWriteEpc.epc = new S_EPC("E2003412012345678900AABB"); rfid.StartOperation(Operation.TAG_WRITE_EPC); // Write to User memory bank (2 words at offset 0) rfid.Options.TagWriteUser.accessPassword = 0x00000000; rfid.Options.TagWriteUser.bank = MemoryBank.USER; rfid.Options.TagWriteUser.offset = 0; rfid.Options.TagWriteUser.count = 2; rfid.Options.TagWriteUser.pData = new UInt16[] { 0x1234, 0x5678 }; rfid.Options.TagWriteUser.flags = SelectFlags.SELECT; rfid.StartOperation(Operation.TAG_WRITE_USER); ``` -------------------------------- ### Read Tag Memory (EPC/TID) with OnAccessCompleted Source: https://context7.com/cslrfid/cslibrary/llms.txt Configure and initiate tag memory reads (EPC, TID) and handle results via the OnAccessCompleted event. Ensure TagReadEpcParms, TagReadTidParms, etc., are used for data parsing. ```csharp using CSLibrary; using CSLibrary.Constants; using CSLibrary.Events; using CSLibrary.Structures; RFIDReader rfid = reader.rfid; // Subscribe to read completion rfid.OnAccessCompleted += (sender, e) => { if (e.success && e.access == TagAccess.READ) { Console.WriteLine($"Read bank: {e.bank}"); if (e.bank == Bank.EPC) { var epcData = (TagReadEpcParms)e.data; Console.WriteLine($"EPC: {epcData.epc}"); } else if (e.bank == Bank.TID) { var tidData = (TagReadTidParms)e.data; Console.WriteLine($"TID words: {tidData.count}"); } } else { Console.WriteLine($"Read failed: bank={e.bank}"); } }; // Configure TID read: 4 words from offset 0, no access password rfid.Options.TagReadTid.accessPassword = 0x00000000; rfid.Options.TagReadTid.offset = 0; rfid.Options.TagReadTid.count = 4; // Target a specific tag by EPC using select criteria first (see SetSelectCriteria above) rfid.StartOperation(Operation.TAG_READ_TID); ``` -------------------------------- ### Channel Configuration Source: https://github.com/cslrfid/cslibrary/blob/main/CSLibraryBT/Readme.txt Functions for setting fixed, hopping, and agile channels. ```APIDOC ## Set Fixed Channel ### Description Configures the reader to use a specific fixed frequency channel within a region. ### Method POST ### Endpoint /rfid/channel/fixed ### Parameters #### Request Body - **region** (RegionCode) - Optional - The region code. Defaults to CURRENT. - **channel** (uint) - Optional - The specific channel frequency identifier. Defaults to 0. ### Request Example ```json { "region": "FCC", "channel": 10 } ``` ### Response #### Success Response (200) - **result** (Result) - Indicates success or failure of the operation. ### Response Example ```json { "result": "SUCCESS" } ``` ## Set Hopping Channels (with region) ### Description Configures the reader to use hopping channels within a specified region. ### Method POST ### Endpoint /rfid/channel/hopping ### Parameters #### Request Body - **region** (RegionCode) - Required - The region code for hopping channels. ### Request Example ```json { "region": "ETSI" } ``` ### Response #### Success Response (200) - **result** (Result) - Indicates success or failure of the operation. ### Response Example ```json { "result": "SUCCESS" } ``` ## Set Hopping Channels (current region) ### Description Configures the reader to use hopping channels within the currently selected region. ### Method POST ### Endpoint /rfid/channel/hopping/current ### Response #### Success Response (200) - **result** (Result) - Indicates success or failure of the operation. ### Response Example ```json { "result": "SUCCESS" } ``` ## Set Agile Channels ### Description Configures the reader to use agile channels within a specified region. ### Method POST ### Endpoint /rfid/channel/agile ### Parameters #### Request Body - **region** (RegionCode) - Required - The region code for agile channels. ### Request Example ```json { "region": "FCC" } ``` ### Response #### Success Response (200) - **result** (Result) - Indicates success or failure of the operation. ### Response Example ```json { "result": "SUCCESS" } ``` ``` -------------------------------- ### Singulation and Filtering Source: https://github.com/cslrfid/cslibrary/blob/main/CSLibraryBT/Readme.txt Functions for configuring singulation criteria, tag groups, and algorithms. ```APIDOC ## Set Post-Match Criteria ### Description Configures the criteria used for filtering tags after a match. ### Method POST ### Endpoint /rfid/singulation/postmatch ### Parameters #### Request Body - **criteria** (SingulationCriterion[]) - Required - An array of singulation criteria. ### Request Example ```json { "criteria": [ {"type": "RSSI", "threshold": -70} ] } ``` ### Response #### Success Response (200) - **result** (Result) - Indicates success or failure of the operation. ### Response Example ```json { "result": "SUCCESS" } ``` ## Set Tag Group ### Description Sets the parameters for grouping tags during inventory. ### Method POST ### Endpoint /rfid/taggroup ### Parameters #### Request Body - **tagGroup** (TagGroup) - Required - The tag group parameters. ### Request Example ```json { "stateAwareSingulation": true, "session": "SESSION_S0" } ``` ### Response #### Success Response (200) - **result** (Result) - Indicates success or failure of the operation. ### Response Example ```json { "result": "SUCCESS" } ``` ## Get Tag Group ### Description Retrieves the current tag group parameters. ### Method GET ### Endpoint /rfid/taggroup ### Response #### Success Response (200) - **tagGroup** (TagGroup) - The current tag group parameters. ### Response Example ```json { "stateAwareSingulation": true, "session": "SESSION_S0" } ``` ## Set Current Singulation Algorithm ### Description Sets the singulation algorithm to be used for tag detection. ### Method POST ### Endpoint /rfid/singulation/algorithm ### Parameters #### Request Body - **algorithm** (SingulationAlgorithm) - Required - The singulation algorithm to set. ### Request Example ```json { "algorithm": "ALG_DYNAMICQ" } ``` ### Response #### Success Response (200) - **result** (Result) - Indicates success or failure of the operation. ### Response Example ```json { "result": "SUCCESS" } ``` ## Get Current Singulation Algorithm ### Description Retrieves the currently active singulation algorithm. ### Method GET ### Endpoint /rfid/singulation/algorithm/current ### Response #### Success Response (200) - **algorithm** (SingulationAlgorithm) - The current singulation algorithm. ### Response Example ```json { "algorithm": "ALG_DYNAMICQ" } ``` ``` -------------------------------- ### Discover BLE Devices with DeviceFinder Source: https://context7.com/cslrfid/cslibrary/llms.txt Scan for nearby BLE RFID readers and handle discovery events. Store the native device information for subsequent connection attempts. ```csharp using CSLibrary; // Subscribe to device discovery events DeviceFinder.OnSearchCompleted += (sender, e) => { Console.WriteLine($"Found device: {e.Found.deviceName} (ID={e.Found.ID})"); // Store e.Found.nativeDeviceInformation to pass to ConnectAsync later }; // Start scanning DeviceFinder.SearchDevice(); // ... Later, stop scanning DeviceFinder.Stop(); DeviceFinder.ClearDeviceList(); ``` -------------------------------- ### Configure RFID Reader Antenna Ports Source: https://context7.com/cslrfid/cslibrary/llms.txt Manages logical antenna port states and configurations like power level and dwell time. Supports up to 16 logical ports. Ensure the reader is initialized before configuring ports. ```csharp using CSLibrary; using CSLibrary.Constants; using CSLibrary.Structures; RFIDReader rfid = reader.rfid; // Initialize antenna list to hardware defaults rfid.SetDefaultAntennaList(); // Enable port 0 with custom settings var config = new AntennaPortConfig { powerLevel = 300, // 30.0 dBm dwellTime = 2000, // 2000 ms numberInventoryCycles = 0 // unlimited }; rfid.SetAntennaPortConfiguration(port: 0, config); rfid.SetAntennaPortState(port: 0, AntennaPortState.ENABLED); // Disable port 1 rfid.SetAntennaPortState(port: 1, AntennaPortState.DISABLED); // Query current port count uint portCount = rfid.GetAntennaPort(); Console.WriteLine($"Active antenna ports: {portCount}"); ``` -------------------------------- ### Configure RFID Tag Selection Criteria Source: https://context7.com/cslrfid/cslibrary/llms.txt Applies ISO 18000-6C select commands to pre-filter tags before inventory. `SetTagGroup` controls session flags. Remember to cancel criteria when done to avoid unintended filtering. ```csharp using CSLibrary; using CSLibrary.Constants; using CSLibrary.Structures; RFIDReader rfid = reader.rfid; // Select only tags whose EPC starts with "E200" var criterion = new SelectCriterion { action = SelectAction.DSLINVSL, target = SelectTarget.S0, bank = MemoryBank.EPC, offset = 32, // bit offset (skip PC+CRC) count = 16, // 16 bits to match mask = new byte[] { 0xE2, 0x00 }, // match pattern truncate = false }; rfid.SetSelectCriteria(new[] { criterion }); rfid.SetTagGroup(Selected.SELECT, Session.S0, SessionTarget.A); // Start targeted inventory rfid.Options.TagRanging.flags = SelectFlags.SELECT; rfid.StartOperation(Operation.TAG_RANGING); // Remove filter when done rfid.CancelAllSelectCriteria(); rfid.SetTagGroup(Selected.ALL, Session.S0, SessionTarget.A); ``` -------------------------------- ### RFID Q Parameter Functions Source: https://github.com/cslrfid/cslibrary/blob/main/CSLibrary2024/Readme.txt Functions to configure Fixed Q and Dynamic Q parameters for RFID inventory. ```APIDOC ## SetFixedQParms ### Description Sets the parameters for the Fixed Q singulation algorithm. ### Method Set ### Endpoint RFID/QParameters/Fixed ### Parameters #### Request Body - **fixedQParm** (FixedQParms) - Required - The Fixed Q parameters to set ``` ```APIDOC ## GetFixedQParms ### Description Gets the current Fixed Q parameters. ### Method Get ### Endpoint RFID/QParameters/Fixed/Current ### Parameters #### Query Parameters - **fixedQ** (ref FixedQParms) - Required - Output parameter for the current Fixed Q parameters ### Response #### Success Response (200) - **Result**: Operation result ``` ```APIDOC ## SetDynamicQParms ### Description Sets the parameters for the Dynamic Q singulation algorithm. ### Method Set ### Endpoint RFID/QParameters/Dynamic ### Parameters #### Request Body - **dynParm** (DynamicQParms) - Required - The Dynamic Q parameters to set ``` ```APIDOC ## GetDynamicQParms ### Description Gets the current Dynamic Q parameters. ### Method Get ### Endpoint RFID/QParameters/Dynamic/Current ### Parameters #### Query Parameters - **parms** (ref DynamicQParms) - Required - Output parameter for the current Dynamic Q parameters ### Response #### Success Response (200) - **Result**: Operation result ``` -------------------------------- ### CSLibrary.notification Callback Events Source: https://github.com/cslrfid/cslibrary/blob/main/CSLibraryBT/Readme.txt Callback events that provide real-time updates on reader voltage and key presses. ```APIDOC ## OnVoltageEvent ### Description Callback event triggered when the battery voltage changes. ### Event Signature `EventHandler OnVoltageEvent` ### Parameters - `VoltageEventArgs`: Contains information about the voltage change. ``` ```APIDOC ## OnKeyEvent ### Description Callback event triggered when a hotkey is pressed on the reader. ### Event Signature `EventHandler OnKeyEvent` ### Parameters - `HotKeyEventArgs`: Contains information about the key press. ``` -------------------------------- ### CSLibrary.siliconlabIC Functions Source: https://github.com/cslrfid/cslibrary/blob/main/CSLibraryBT/Readme.txt Functions to manage the firmware version and device name for the Silicon Labs IC. ```APIDOC ## GetFirmwareVersion (Silicon Labs IC) ### Description Retrieves the firmware version of the Silicon Labs IC. ### Method `uint GetFirmwareVersion()` ### Parameters None ### Returns - `uint`: The firmware version. ``` ```APIDOC ## GetDeviceName ### Description Retrieves the current device name. ### Method `string GetDeviceName()` ### Parameters None ### Returns - `string`: The device name. ``` ```APIDOC ## SetDeviceName ### Description Sets a new name for the device. ### Method `bool SetDeviceName(string deviceName)` ### Parameters - `deviceName` (string): The desired new name for the device. ### Returns - `bool`: True if the name was set successfully, false otherwise. ``` -------------------------------- ### Operation Mode and Inventory Settings Source: https://github.com/cslrfid/cslibrary/blob/main/CSLibraryBT/Readme.txt Functions to control the reader's operation mode and inventory parameters. ```APIDOC ## Set Operation Mode ### Description Sets the radio operation mode (e.g., CONTINUOUS, NON-CONTINUOUS). ### Method POST ### Endpoint /rfid/operation/mode ### Parameters #### Request Body - **mode** (RadioOperationMode) - Required - The desired operation mode. ### Request Example ```json { "mode": "CONTINUOUS" } ``` ### Response #### Success Response (200) - **result** (Result) - Indicates success or failure of the operation. ### Response Example ```json { "result": "SUCCESS" } ``` ## Get Operation Mode ### Description Retrieves the current operation mode of the reader. ### Method GET ### Endpoint /rfid/operation/mode/current ### Response #### Success Response (200) - **mode** (RadioOperationMode) - The current operation mode. ### Response Example ```json { "mode": "CONTINUOUS" } ``` ## Set Inventory Antenna Cycle ### Description Sets the number of cycles for inventory on each antenna. ### Method POST ### Endpoint /rfid/inventory/antenna/cycles ### Parameters #### Request Body - **cycles** (ushort) - Required - The number of cycles per antenna. ### Request Example ```json { "cycles": 4 } ``` ### Response #### Success Response (200) - **result** (Result) - Indicates success or failure of the operation. ### Response Example ```json { "result": "SUCCESS" } ``` ## Set Inventory Duration ### Description Sets the duration (dwell time) for each inventory scan. ### Method POST ### Endpoint /rfid/inventory/duration ### Parameters #### Request Body - **duration** (uint) - Required - The inventory duration in milliseconds. ### Request Example ```json { "duration": 100 } ``` ### Response #### Success Response (200) - **result** (Result) - Indicates success or failure of the operation. ### Response Example ```json { "result": "SUCCESS" } ``` ## Set Inventory Cycles Count ### Description Sets the total number of inventory cycles to perform. ### Method POST ### Endpoint /rfid/inventory/cycles/total ### Parameters #### Request Body - **cycleCount** (uint) - Required - The total number of inventory cycles. ### Request Example ```json { "cycleCount": 10 } ``` ### Response #### Success Response (200) - **result** (Result) - Indicates success or failure of the operation. ### Response Example ```json { "result": "SUCCESS" } ``` ``` -------------------------------- ### HighLevelInterface.ConnectAsync() / DisconnectAsync() Source: https://context7.com/cslrfid/cslibrary/llms.txt Manages the BLE connection lifecycle to a discovered RFID reader. ConnectAsync initiates the connection, and DisconnectAsync gracefully closes it. ```APIDOC ## HighLevelInterface.ConnectAsync() / DisconnectAsync() — BLE Connection Management ### Description Initiates an asynchronous BLE connection to a discovered device. Upon successful connection, the `OnReaderStateChanged` event is triggered with `ReaderCallbackType.CONNECT_SUCESS`, and the reader's sub-handlers become available. The `DisconnectAsync()` method is used to gracefully terminate the connection. ### Usage ```csharp using CSLibrary; HighLevelInterface reader = new HighLevelInterface(); reader.OnReaderStateChanged += (sender, e) => { if (e.type == CSLibrary.Constants.ReaderCallbackType.CONNECT_SUCESS) { Console.WriteLine($"Connected. MAC: {reader.GetMacAddress()}"); Console.WriteLine($"Reader state: {reader.Status}"); // READERSTATE.IDLE } }; // Connect using native device information from DeviceFinder var deviceInfo = DeviceFinder.GetDeviceInformation("CS710S_001234"); // by name await reader.ConnectAsync(deviceInfo.nativeDeviceInformation); // ... use reader ... // Disconnect await reader.DisconnectAsync(); ``` ``` -------------------------------- ### CSLibrary.rfid Callback Events Source: https://github.com/cslrfid/cslibrary/blob/main/CSLibraryBT/Readme.txt Callback events for RFID operations, including inventory, tag searching, access completion, and reader state changes. ```APIDOC ## OnAsyncCallback ### Description Callback event that returns inventory or searching tag data. ### Event Signature `public event EventHandler OnAsyncCallback` ### Parameters - `CSLibrary.Events.OnAsyncCallbackEventArgs`: Contains inventory or searching tag data. ### Event Types - `CSLibrary.Constants.CallbackType.TAG_RANGING`: Indicates inventory data. - `CSLibrary.Constants.CallbackType.TAG_SEARCHING`: Indicates searching tag data. ``` ```APIDOC ## OnAccessCompleted ### Description Callback event that returns the result of read/write/lock operations on RFID tags. ### Event Signature `public event EventHandler OnAccessCompleted` ### Parameters - `CSLibrary.Events.OnAccessCompletedEventArgs`: Contains the result of the access operation. ``` ```APIDOC ## OnStateChanged (RFID) ### Description Callback event that returns the state of the RFID reader. ### Event Signature `public event EventHandler OnStateChanged` ### Parameters - `CSLibrary.Events.OnStateChangedEventArgs`: Contains the RFID reader state. ### Event Types - `CSLibrary.Constants.RFState.INITIALIZATION_COMPLETE`: The RFID reader has completed initialization. - `CSLibrary.Constants.RFState.IDLE`: The RFID reader is in idle mode and ready to receive commands. - `CSLibrary.Constants.RFState.BUSY`: The RFID reader is currently busy with an operation. ```