-
Notifications
You must be signed in to change notification settings - Fork 6
Sending settings
Zacharias Manuel edited this page Oct 30, 2015
·
2 revisions
There are three types of Settings that can be sent to device
- Neyya bluetooth name
- Hand preference
- Gesture speed
You can change the bluetooth name of the device. The name should be less that 15 characters
Create Settings object, add the name settings and send the broadcast
Settings settings = new Settings();
settings.setRingName(newName);
final Intent intent = new Intent(MyService.BROADCAST_COMMAND_SETTINGS);
intent.putExtra(MyService.DATA_SETTINGS, settings);
sendBroadcast(intent);
Available hand preferences.
- Settings.LEFT_HAND
- Settings.RIGHT_HAND
Create the object of Settings class, add the Hand preference and send the broadcast.
Settings settings = new Settings();
settings.setHandPreference(Settings.RIGHT_HAND);
final Intent intent = new Intent(MyService.BROADCAST_COMMAND_SETTINGS);
intent.putExtra(MyService.DATA_SETTINGS, settings);
sendBroadcast(intent);
Available gesture speed
- Settings.SPEED_SLOW
- Settings.SPEED_MEDIUM
- Settings.SPEED_FAST
Create the object of Settings, add the gesture speed preference and send the broadcast
Settings settings = new Settings();
settings.setGestureSpeed(Settings.SPEED_MEDIUM);
final Intent intent = new Intent(MyService.BROADCAST_COMMAND_SETTINGS);
intent.putExtra(MyService.DATA_SETTINGS, settings);
sendBroadcast(intent);
The status of settings sending is coming back through the broadcast receiver
private final BroadcastReceiver mNeyyaUpdateReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
final String action = intent.getAction();
if (MyService.BROADCAST_INFO.equals(action)) {
int status = intent.getIntExtra(MyService.DATA_INFO, 0);
switch (status) {
case MyService.STATUS_RING_NAME_CHANGE_SUCCESS:
showData("Ring name changed");
break;
case MyService.STATUS_RING_NAME_CHANGE_FAILED:
showData("Ring name change failed");
break;
case MyService.STATUS_HAND_CHANGE_SUCCESS:
showData("Hand changed");
break;
case MyService.STATUS_HAND_CHANGE_FAILED:
showData("Hand change failed");
break;
case MyService.STATUS_GESTURE_SPEED_CHANGE_SUCCESS:
showData("Gesture speed changed");
break;
case MyService.STATUS_GESTURE_SPEED_CHANGE_FAILED:
showData("Gesture speed change failed");
break;
}
}
}
}
Possible error in settings sending
- ERROR_PACKET_DELIVERY_FAILED
- ERROR_NAME_LENGTH_EXCEEDS
- ERROR_REMOTE_COMMAND_EXECUTION_FAILED
- ERROR_UNKNOWN_HAND_REQUEST
- ERROR_UNKNOWN_GESTURE_SPEED_REQUEST
Download the sdk with sample code from here