Difference between revisions of "Callibri Motion Assistant Quickstart"

From Neurotech Software Development Kit
Jump to: navigation, search
(iOS)
Line 16: Line 16:
  
 
init(){
 
init(){
   neuroConnection = NCNeuroConnection()
+
   maConnection = NCMotionAssistantConnection()
 
}
 
}
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 +
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:
 +
 +
<syntaxhighlight>
 +
maConnection.setScanStateChangedCallback(onDeviceFound)
 +
</syntaxhighlight>
 +
 +
where onDeviceFound is a callback method which handles device found event
 +
 +
<syntaxhighlight>
 +
private func onDeviceFound(maDevice: NCMotionAssistantDevice?){
 +
        //you code here
 +
    }
 +
</syntaxhighlight>
  
 
@interface NCMotionAssistantConnection : NSObject
 
@interface NCMotionAssistantConnection : NSObject

Revision as of 06:55, 3 March 2017

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

Android

iOS

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.

private var maConnection: NCMotionAssistantConnection

init(){
   maConnection = NCMotionAssistantConnection()
}

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
    }

@interface NCMotionAssistantConnection : NSObject

-(void)startScan:(int)timeout; -(void)stopScan; -(NCMotionAssistantDevice *)getDeviceByAddress:(const NSString*)address; -(void)setScanStateChangedCallback:(void(^)(bool isScanning)) scanStateChangedCallback; -(void)setDeviceFoundCallback:(void(^)(NCMotionAssistantDevice *)) deviceFoundCallback;

@end

@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