Serialio

SerialPort Power Management Examples

SerialPort provides power management for PCMCIA and CF cards.* This allows you to maximize battery life by minimizing the power consumption of your application. Using the power management features is very simple. Below, you’ll find a couple of example snippets that demonstrate SerialPort’s power management capabilities.

Example 1 — Querying the state of a particular card slot:

int slot = choiceSlot.getSelectedIndex();
int pMode = SerialPortLocal.getPowerMode(slot);

Example 2 — Setting the card state to standby or active:

int pMode = 1;
if (cbStandby.getState()) pMode = 0;
int slot = choiceSlot.getSelectedIndex();
SerialPortLocal.setPowerMode(slot, pMode);

*Not supported on all platforms