JoyaTouch Cradle Sample API

This tutorial exercises functionality provided by the Datalogic Xamarin SDK Self-shopping Extension. The sample app is divided into several Activities, one per each topic below.

Cradle State

Access details such as whether or not the device is in a cradle, the cradle's version, device insertion count, slot index, and whether or not fast charging is supported. These details are stored in the  StateInfo class. Example usage:

ICradleJoyaTouch jtCradle  = (ICradleJoyaTouch) CradleManager.Cradle;

StateInfo state = new StateInfo();
if (jtCradle.GetCradleState(state))
string insCount = "Insertion count: " + state.InsertionCount;

Cradle LEDs

Change the state of the LEDs on the cradle by using the  LedAction class. Example usage:

ICradleJoyaTouch jtCradle  = (ICradleJoyaTouch) CradleManager.Cradle;
jtCradle.ControlLed(LedAction.BlinkSlow);

Cradle Lock

Change the state of the cradle lock using the  LockAction class. Example usage:

ICradleJoyaTouch jtCradle  = (ICradleJoyaTouch) CradleManager.Cradle;
jtCradle.ControlLock(Action.UnlockWithLedOn);

Cradle Config Area

Use the  ConfigArea class to access the current cradle slot's configuration area, consisting of an array of bytes. Also, an exposed method allows to get or set the fast charge value contained in one of the bytes of the configuration area.

ICradleJoyaTouch jtCradle  = (ICradleJoyaTouch) CradleManager.Cradle;
ConfigArea config = new ConfigArea();
byte[] configValues;
if (jtCradle.ReadConfigArea(config))
{
configValues = config.GetContent();
}

Cradle Custom Area

Use the  CustomArea class to access the custom data area of the cradle slot being occupied.

ICradleJoyaTouch jtCradle  = (ICradleJoyaTouch) CradleManager.Cradle;
CustomArea custom = new CustomArea();
byte[] customValues;
if (jtCradle.ReadCustomArea(custom, custom.Size))
{
customValues = custom.GetContent();
}

i