Skip to content

Commit

Permalink
CI Tests with standalone executables
Browse files Browse the repository at this point in the history
  • Loading branch information
ScottThomasMiller committed Apr 14, 2024
1 parent 0a823f9 commit db7c7aa
Show file tree
Hide file tree
Showing 46 changed files with 7,054 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>BrainFlow.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>4</integer>
</dict>
</dict>
</dict>
</plist>
13 changes: 13 additions & 0 deletions swift_package/BrainFlow/BrainFlow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// Created by Scott Miller on 4/9/22.
//

#ifndef BrainFlow_h
#define BrainFlow_h

#include "board_controller.h"
#include "data_handler.h"
#include "board_info_getter.h"
#include "ml_module.h"

#endif /* BrainFlow_h */
16 changes: 16 additions & 0 deletions swift_package/BrainFlow/Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"object": {
"pins": [
{
"package": "swift-numerics",
"repositoryURL": "https://github.com/apple/swift-numerics.git",
"state": {
"branch": null,
"revision": "0a5bc04095a675662cf24757cc0640aa2204253b",
"version": "1.0.2"
}
}
]
},
"version": 1
}
33 changes: 33 additions & 0 deletions swift_package/BrainFlow/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// swift-tools-version:5.3
import PackageDescription

let package = Package(
name: "BrainFlow",
platforms: [
.macOS(.v10_15), .iOS(.v13)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(name: "BrainFlow",
targets: ["BrainFlow"])
],
dependencies: [
.package(name: "swift-numerics",
url: "https://github.com/apple/swift-numerics.git", .upToNextMajor(from: "1.0.0"))
],
targets: [
.target(
name: "BrainFlow",
dependencies: [.product(name: "Numerics", package: "swift-numerics")]
),
.testTarget(
name: "BrainFlowTests",
dependencies: ["BrainFlow", .product(name: "Numerics", package: "swift-numerics")],
sources: ["BoardShimTests.swift",
"BrainFlowCItests.swift",
"BrainFlowTests.swift",
"DataFilterTests.swift"]
)
]
)

4 changes: 4 additions & 0 deletions swift_package/BrainFlow/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# BrainFlow

Swift bindings for the BrainFlow C++ API. Contributed by Scott Miller for Aeris Rising, LLC.

7 changes: 7 additions & 0 deletions swift_package/BrainFlow/Sources/BrainFlow/dummy.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

import Foundation

struct dummy {
let num = 1
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
//
// BoardDescription.swift
// a Swift reimagining of BrainFlow's board_description data type
//
// Created by Scott Miller for Aeris Rising, LLC on 8/23/21.
//
import Foundation
//import BrainFlow

struct BoardDescription: Codable, Equatable {
let package_num_channel: Int32
let timestamp_channel: Int32
let accel_channels: [Int32]?
let ecg_channels: [Int32]?
let eeg_channels: [Int32]?
let eeg_names: String?
let emg_channels: [Int32]?
let eog_channels: [Int32]?
let marker_channel: Int32?
let name: String?
let num_rows: Int32?
let sampling_rate: Int32?
let battery_channel: Int32?
let eda_channels: [Int32]?
let gyro_channels: [Int32]?
let ppg_channels: [Int32]?
let resistance_channels: [Int32]?
let temperature_channels: [Int32]?

// decode the input JSON into self:
init(_ descriptionJSON: String) throws {
guard descriptionJSON != "" else {
throw BrainFlowException("Nil board description JSON", .JSON_NOT_FOUND_ERROR)
}

let decoder = JSONDecoder()
let jsonData = Data(descriptionJSON.utf8)

do {
let json = try decoder.decode(type(of: self), from: jsonData)
self = json
} catch {
try? BoardShim.logMessage(.LEVEL_CRITICAL, "board description JSON decoding error:\n \(error)")
throw BrainFlowException("Invalid board description JSON", .NO_SUCH_DATA_IN_JSON_ERROR)
}
}
}
Loading

0 comments on commit db7c7aa

Please sign in to comment.