# Reader Reference

# Configuring and Controlling Stack Lights

A stack light is a device containing up to five signaling lights that can be attached to an RFID device. WebLogic RFID Edge Server supports multi-color stack light configuration for these devices: Symbol AR400, Symbol XR400, and Alien ALR-9780.

The following sections describes configuring and controlling stack lights.

- Stack Light Configuration
- Stack Light Control

## Stack Light Configuration

For each stack light to be used, you assign a Logical Reader Name during reader configuration (much like an antenna). Other properties may be configured as needed.

Figure 3-1 illustrates a Symbol AR400 reader stack light configuration, showing example host names and logical reader names, and default values for other properties.

Figure 3-1 Symbol AR400 Stack Light Configuration

## Stack Light Control

Stack light control can be accomplished by writing a special EPC value to the logical reader representing a stack light. The EPC is represented by the URI: `urn:connecterra:stacklight:update=<update value>`

The update value consists of five hexadecimal digits. Each digit sets the display on one of the five supported colors (from most significant to least significant): White, Blue, Green, Amber, and Red. Each digit can be one of the following values:

- 0 = turns the color off
- 1-8 = turns the color on for 5 seconds times the value shown
- 9 = turns the color on indefinitely, until a different value is written
- F = does not change the current state

Values of A-E are reserved for future use.

If the update value written to the logical reader has more than five digits, the rightmost five digits are read to set the stack light colors (e.g., 88880000 is read as 80000).

Note: | For specific devices, an exception is thrown when the update value has more than five digits; use an update value containing only five digits in those cases.

If the update value has less than five digits, the number is padded with zeroes on the left before the value is sent to the logical reader (e.g., FF0 is read as 00FF0).

Example Value: A URI of `urn:connecterra:stacklight:update=092F0` written to a stack light configured as described above will perform the following actions on the stack light:

- 0 - turns off the White light
- 9 - turns on the Blue light indefinitely, until next update
- 2 - turns on the Green light for 10 seconds
- F - leaves the Amber light unchanged
- 0 - turns off the Red light
Listing 3-1 Example API call

    // This is a code fragment
    ALEPC alePCClient = new AxisALEPCClient(<alepcServiceURL>);
    ALEPCFactory alePCFactory = AxisALEPCFactory.getInstance();
    PCSpec pcSpec = alePCFactory.createPCSpec()
    pcSpec.addLogicalReaderName("Dock_Door_Stack_Light");
    alePCClient.immediate(
    		pcSpec, new URI("urn:connecterra:stacklight:update=092F0"));

Alternatively, stack light control can be accomplished by writing a value to a tag memory URI:

`urn:connecterra:tagmem:@stacklight.X.Y` and the update value is `urn:epc:raw:<update value>`, where:

- `X`—Number of bits (can be 4, 8, 12, 16, or 20); the memory bank is 20 bits wide, each 4 bits corresponds to one light.
- `Y`—Offset (can be 0, 4, 8, 12, or 16); an offset of 12 means that the first twelve bits are skipped.
- `update value`—Up to five hexadecimal digits (as described in Stack Light Control), depending on the number of bits and the offset value specified by `X.Y`.

Examples:

- `urn:connecterra:tagmem:@stacklight.4.12` and update value `urn:epc:raw:64.x9`; turns the amber light on indefinitely (starting from bit 12, 4 bits).

In this example, `@stacklight.4.12` means write 4 bits starting at offset 12. Offsets start at 0 and 12 bits are skipped. The 4 bits in the update value (for example, x9) are written in bits 12, 13, 14, 15.

- `urn:connecterra:tagmem:@stacklight.20.0` and update value `urn:epc:raw:64.x99999`; turns on all the lights indefinitely (starting from bit 0, 20 bits).
Listing 3-2 Example PCSpec

    <?xml version="1.0" encoding="UTF-8"?>
    <PCSpec xmlns="http://schemas.connecterra.com/alepc">
      <applicationData>Write Tag Memory with stacklight</applicationData>
      <applicationData>pass EPC value as an argument</applicationData>
      <logicalReaders>
        <logicalReader>StackLight</logicalReader>
      </logicalReaders>
      <boundarySpec>
        <trials>1</trials>
        <duration>4000</duration>
      </boundarySpec>
      <accessSpec>
        <operations>
          <operation>
          <!-- Write Tag Memory with stacklight;pass EPC value as argument -->
                <write field="urn:connecterra:tagmem:@stacklight.20.0">
                    <param>epc</param>
            </write>
          </operation>
        </operations>
      </accessSpec>
    </PCSpec>

For more information, see Writing Tags Using the ALEPC API in Programming with the ALE and ALEPC APIs.