Difference between revisions of "Callibri Motion Assistant Quickstart"
NateColeman (talk | contribs) (→iOS) |
NateColeman (talk | contribs) (→Connection) |
||
(10 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | This page describes simple steps for starting use Callibri MotionAssistant device in yours application. | ||
+ | To get more information about device classes see [[Motion Assistant Device| MotionAssistant device page]] | ||
+ | |||
To start using neurotech software development kit first [[Including SDK Library|include]] appropriate library into your project. | To start using neurotech software development kit first [[Including SDK Library|include]] appropriate library into your project. | ||
Line 5: | Line 8: | ||
== iOS == | == iOS == | ||
− | + | === Connection === | |
For distinct types of devices it is prefered to use specialized scanner classes. | 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. | Use NCMotionAssistantConnection class to scan for MotionAssistant devices. It will scan BTLE devices and notify about only MotionAssistant devices been found. | ||
Line 12: | Line 15: | ||
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. | 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 | private var maConnection: NCMotionAssistantConnection | ||
Line 18: | Line 21: | ||
maConnection = NCMotionAssistantConnection() | 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. | 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. | ||
Line 36: | Line 39: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | + | Start scan method receives scanning timeout in milliseconds as his first parameter: | |
+ | <syntaxhighlight> | ||
+ | //start scan for 10 seconds | ||
+ | maConnection.startScan(10000) | ||
+ | |||
+ | //to stop scan just call: | ||
+ | maConnection.stopScan() | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | To track scan state you could subscribe state change event: | ||
+ | <syntaxhighlight> | ||
+ | maConnection.setScanStateChangedCallback(onScanStateChanged) | ||
+ | |||
+ | //scan state changed callback method | ||
+ | private func onScanStateChanged(isScanning: Bool){ | ||
+ | //your code here | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | For more information see [[MotionAssistantConnection Class|MotionAssistantConnection class page]] | ||
− | + | === Using Device === | |
− | |||
− | |||
− | |||
− | |||
− | + | [[EcgDeviceConnector Class]] | |
@interface NCMotionAssistantDevice : NSObject | @interface NCMotionAssistantDevice : NSObject |
Latest revision as of 07:24, 16 March 2017
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.
Contents
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
@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