Difference between revisions of "Callibri Motion Assistant Quickstart"

From Neurotech Software Development Kit
Jump to: navigation, search
(Connection)
 
(15 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.
  
 
== Android ==
 
== Android ==
Line 4: 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 11: 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.
  
<syntaxhighlight lang="objc">
+
<source lang=c>
 
 
.
 
.
 
.
 
 
private var maConnection: NCMotionAssistantConnection
 
private var maConnection: NCMotionAssistantConnection
  
 
init(){
 
init(){
:.
+
  maConnection = NCMotionAssistantConnection()
:.
 
:.
 
:neuroConnection = NCNeuroConnection()
 
:.
 
:.
 
 
}
 
}
 +
</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:
 +
 +
<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>
  
.
+
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>
 
</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>
  
@interface NCMotionAssistantConnection : NSObject
+
For more information see [[MotionAssistantConnection Class|MotionAssistantConnection class page]]
  
-(void)startScan:(int)timeout;
+
=== Using Device ===
-(void)stopScan;
 
-(NCMotionAssistantDevice *)getDeviceByAddress:(const NSString*)address;
 
-(void)setScanStateChangedCallback:(void(^)(bool isScanning)) scanStateChangedCallback;
 
-(void)setDeviceFoundCallback:(void(^)(NCMotionAssistantDevice *)) deviceFoundCallback;
 
  
@end
+
[[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.

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