Steth-IO-SDK
示例
要运行示例项目,首先从 Example 目录克隆仓库。
要求
- 由于滤波器是按照这种方式设计的,录制频率必须是 44.1khz。
- 只有与 Steth IO 硬件配合使用时,心肺滤波器才能按预期工作。
安装 📱
CocoaPods
使用 CocoaPods。
- 在您的 Podfile 中添加如下代码以使用
pod 'Steth-IO-SDK'
。
pod 'Steth-IO-SDK', :git => 'https://github.com/StratoScientific/Steth-IO-SDK-iOS.git'
- 通过运行
pod install
来安装 pod。 - 在您想要使用 StethIO 的 .swift 文件中添加
import StethIO
。
SDK 使用 ✨
- 在 ViewController 中
//Initializer let stethManager = StethIOManager.shared //Enter your API key here stethManager.apiKey = "YOUR_API_KEY" //Set delegate to receive bpm and saved samples url stethManager.delegate = self //set the filter mode to heart/lung stethManager.examType = .heart // heart/lungs //set the sample type to none/processedSamples/rawSamples stethManager.sampleType = .none production or stagging manager.environment = .stagging //here we need to process the biquad files and apply filter try stethManager.prepare() //This will start the recording try self.stethManager.start() //This will stop the recording try self.stethManager.finish() cancel session try self.stethManager.cancel()
### StethIODelegate
///MARK:- StethIO Delegate
func stethIOManagerReadyToStart() {
SDK read to start the exam. your api key is valid
}
func stethIOManagerDidStarted() {
// exam started
}
func stethIOManagerDidCancelled() {
// exam cancelled by user
}
func stethIOManagerDidUpdateDuration(_ seconds: TimeInterval) {
// while taking the exam exation duration will be update
}
func stethIOManagerDidFinished(url: URL?) {
// after finish the example, return the audio sample local file path
}
func stethIOManagerDidUpdateHeartBPM(_ bpm: Double) {
// it will be trigger only type heart
}
### StethIODelegate SpectrumGLKViewController 用于在视图控制器模式下显示频谱图 SpectrumGLKView 用于在视图模式下显示频谱图
使用代码显示或嵌入 Storyboard
let vc = SpectrumGLKViewController()
present(vc, animated: true)
let view = SpectrumGLKView(frame: <#>)
container.addSubView(view);
⚠️
重要示例应用中的 API_KEY
仅适用于示例应用。在另一个应用中使用相同的密钥将不会生效。
作者
StethIO, [email protected]
许可协议
Steth-IO-SDK 采用 MIT 许可协议。有关更多信息,请参阅 LICENSE 文件。