public interface LEDDevice extends Device
LEDDevice
interface defines the API for interacting with LED devices.
This interface allows applications to control and manipulate the operation of LED hardware.
To obtain an instance of LEDDevice, use the following code:
LEDDevice ledDevice = (LEDDevice) POSTerminal.getInstance().getDevice("com.cloudpos.device.led");Here, "com.cloudpos.device.led" is a string identifier for the LED device, as defined by the specific implementation.
Applications must request permission to access this device as shown:
<uses-permission android:name="android.permission.CLOUDPOS_LED" />
Device
Modifier and Type | Field and Description |
---|---|
static int |
ID_BLUE |
static int |
ID_GREEN |
static int |
ID_RED |
static int |
ID_YELLOW |
static int |
STATUS_OFF
Light off
|
static int |
STATUS_ON
Light on
|
Modifier and Type | Method and Description |
---|---|
void |
blink(byte color,
long delayTurnOn,
long delayTurnOff,
int counts)
Causes the LED to blink a specified number of times with specified durations for ON and OFF states and a specific color.
|
void |
blink(long delayTurnOn,
long delayTurnOff,
int counts)
Causes the LED to blink a specified number of times with specified durations for ON and OFF states.
|
void |
cancelBlink()
Cancels any ongoing LED blinking operation.
|
int |
getLogicalID()
Retrieves the current logical ID of the LED in use.
|
int |
getStatus()
Retrieves the current status of the LED.
|
void |
open(int logicalID)
Opens the specified LED for control.
|
void |
startBlink(byte color,
long delayTurnOn,
long delayTurnOff,
int counts)
Initiates a continuous blinking pattern for the LED with a specified color.
|
void |
startBlink(long delayTurnOn,
long delayTurnOff)
Initiates a continuous blinking pattern for the LED.
|
void |
startBlink(long delayTurnOn,
long delayTurnOff,
int counts)
Initiates a continuous blinking pattern for the LED.
|
void |
turnOff()
Turns the LED off.
|
void |
turnOn()
Turns the LED on.
|
cancelRequest, close, getFailCount, getUsageCount, open
static final int STATUS_OFF
static final int STATUS_ON
static final int ID_BLUE
static final int ID_YELLOW
static final int ID_GREEN
static final int ID_RED
void open(int logicalID) throws DeviceException
logicalID
- The logical ID of the LED to open (ID_BLUE
or ID_YELLOW
or ID_GREEN
or ID_RED
).DeviceException
- for standard reasons as documented in DeviceException
.int getLogicalID() throws DeviceException
DeviceException
- for standard reasons as documented in DeviceException
.void startBlink(long delayTurnOn, long delayTurnOff, int counts) throws DeviceException
cancelBlink()
to abort blinking.delayTurnOn
- Time in milliseconds for the LED to remain on during each blink.delayTurnOff
- Time in milliseconds for the LED to remain off between blinks.counts
- Number of blinking cycles to perform.DeviceException
- for standard reasons as documented in DeviceException
.void startBlink(byte color, long delayTurnOn, long delayTurnOff, int counts) throws DeviceException
cancelBlink()
to abort blinking.color
- The color of the LED.delayTurnOn
- Time in milliseconds for the LED to remain on during each blink.delayTurnOff
- Time in milliseconds for the LED to remain off between blinks.counts
- Number of blinking cycles to perform.DeviceException
- for standard reasons as documented in DeviceException
.void startBlink(long delayTurnOn, long delayTurnOff) throws DeviceException
cancelBlink()
to abort blinking.delayTurnOn
- Time in milliseconds for the LED to remain on during each blink.delayTurnOff
- Time in milliseconds for the LED to remain off between blinks.DeviceException
- for standard reasons as documented in DeviceException
.void cancelBlink() throws DeviceException
DeviceException
- for standard reasons as documented in DeviceException
.void blink(long delayTurnOn, long delayTurnOff, int counts) throws DeviceException
delayTurnOn
- Time in milliseconds for the LED to remain on during each blink.delayTurnOff
- Time in milliseconds for the LED to remain off between blinks.counts
- Number of blinking cycles to perform.DeviceException
- for standard reasons as documented in DeviceException
.void blink(byte color, long delayTurnOn, long delayTurnOff, int counts) throws DeviceException
color
- The color of the LED.delayTurnOn
- Time in milliseconds for the LED to remain on during each blink.delayTurnOff
- Time in milliseconds for the LED to remain off between blinks.counts
- Number of blinking cycles to perform.DeviceException
- for standard reasons as documented in DeviceException
.int getStatus() throws DeviceException
STATUS_OFF
or STATUS_ON
.DeviceException
- for standard reasons as documented in DeviceException
.void turnOn() throws DeviceException
turnOff()
or Device.close()
is called.DeviceException
- for standard reasons as documented in DeviceException
.void turnOff() throws DeviceException
DeviceException
- for standard reasons as documented in DeviceException
.