Callibri Motion Assistant Quickstart

From Neurotech Software Development Kit
Jump to: navigation, search

This page describes simple steps for starting use Callibri MotionAssistant device in yours application. To get more information about device classes see MotionAssistant device page

To start using neurotech software development kit first include appropriate library into your project.

Android

iOS

Connection

For distinct types of devices it is prefered to use specialized scanner classes. Use NCMotionAssistantConnection class to scan for MotionAssistant devices. It will scan BTLE devices and notify about only MotionAssistant devices been found.

To instantiate scanner object define proertie of type NCMotionAssistantConnection in your class and use its default constructor for initialization. Possibly use one instance for scanner for all scan operations in your application instance, there is no need to create scanner objects multiple times to scan several times for example.

<source lang=c> private var maConnection: NCMotionAssistantConnection

init(){

  maConnection = NCMotionAssistantConnection()

} </source>

You will be able to retreive devices in two way: by subscribbing scan notifications and by calling method wich receives device address as a parameter.

To subscribe scan notifications use setDeviceFoundCallback method:

maConnection.setScanStateChangedCallback(onDeviceFound)

where onDeviceFound is a callback method which handles device found event

private func onDeviceFound(maDevice: NCMotionAssistantDevice?){
        //you code here
    }

Start scan method receives scanning timeout in milliseconds as his first parameter:

//start scan for 10 seconds
maConnection.startScan(10000)

//to stop scan just call:
maConnection.stopScan()

To track scan state you could subscribe state change event:

maConnection.setScanStateChangedCallback(onScanStateChanged)

//scan state changed callback method
private func onScanStateChanged(isScanning: Bool){
    //your code here
}

For more information see MotionAssistantConnection class page

Using Device

EcgDeviceConnector Class

@interface NCMotionAssistantDevice : NSObject

-(id) initWithNativeDevice: (void*) device;

-(void) motionAssistantStart; -(void) motionAssistantStop; -(bool) getMotionAssistantState; -(void) setMotionAssistantParams:(int) gyroStart gyroStop:(int)gyroStop limb:(NCMotionAssistantLimb)limb minStimulationPause:(int)minStimulationPause maxStimulationDuration:(int)maxStimulationDuration; -(void) setGyroStartThreshold:(int) gyroStart; -(void) setGyroStopThreshold:(int) gyroStop; -(void) setLimbForStimulation:(NCMotionAssistantLimb) limb; -(void) setMinAssistantStimulationPause:(int) stimulationPause; -(void) setMaxAssistantStimulusDuration:(int) maxStimulDuration; -(int) getGyroStartThreshold; -(int) getGyroStopThreshold; -(NCMotionAssistantLimb) getLimbForStimulation; -(int) getMinAssistantStimulationPause; -(int) getMaxAssistantStimulusDuration; -(void) stimulationStart; -(void) stimulationStop; -(bool) getStimulatorState; -(void) doCalibration; -(void) setStimulatorParams:(int) amplitude pulse_duration:(int) pulse_duration frequency:(int) frequency stim_duration:(int) stim_duration; -(void) setCurrentAmplitude:(int) current; -(void) setPulseDuration:(int) pulseDuration; -(void) setPulseFrequency:(int) pulseFrequency; -(void) setStimulationDuration:(int) stimulationDuration; -(int) getCurrentAmplitude; -(int) getPulseDuration; -(int) getPulseFrequency; -(int) getStimulationDuration; -(void) setAssistantParamsChangedCallback:(void(^)(int gyroStart, int gyroStop, NCMotionAssistantLimb limb, int minStimulationPause, int maxStimulusDuration)) assistantParamsChangedCallback; -(void) setStimulationParamsChangedCallback:(void(^)(int amplitude, int pulse_duration, int frequency, int stimul_duration)) stimulParamsChangedCallback; -(void) setAssistantStateChangedCallback:(void(^)(bool isOn)) assistantStateChangedCallback; -(void) setStimulatorStateChangedCallback:(void(^)(bool isOn)) stimulatorStateChangedCallback;

@end