Skip to content

Commit

Permalink
Add a sample application for data visualization
Browse files Browse the repository at this point in the history
  • Loading branch information
tetujin committed Aug 21, 2019
1 parent 1f00b3e commit e0b9ec6
Show file tree
Hide file tree
Showing 10 changed files with 652 additions and 53 deletions.
37 changes: 29 additions & 8 deletions ESense/Classes/ESenseConfig.swift
Expand Up @@ -12,13 +12,13 @@ public class ESenseConfig: NSObject {
/**
* Gyroscope full scale range in +-degrees/second
*/
public enum GyroRange {
public enum GyroRange:Int8 {
case DEG_250
case DEG_500
case DEG_1000
case DEG_2000

static let values = [DEG_250, DEG_500, DEG_1000, DEG_2000]
public static let values = [DEG_250, DEG_500, DEG_1000, DEG_2000]

func ordinal() -> Int{
return ordinal(self)
Expand All @@ -32,18 +32,24 @@ public class ESenseConfig: NSObject {
}
return 0
}

public var label: String {
let labels = ["DEG_250", "DEG_500", "DEG_1000", "DEG_2000"]
return labels[ordinal(self)]
}
}

/**
* Accelerometer full scale range in +-g
*/
public enum AccRange {
public enum AccRange:Int8 {
case G_2
case G_4
case G_8
case G_16

static let values = [G_2, G_4, G_8, G_16]
public static let values = [G_2, G_4, G_8, G_16]


func ordinal() -> Int{
return ordinal(self)
Expand All @@ -57,12 +63,17 @@ public class ESenseConfig: NSObject {
}
return 0
}

public var label:String {
let labels = ["G_2", "G_4", "G_8", "G_16"]
return labels[ordinal(self)]
}
}

/**
* Gyroscope low pass filter configuration. Each value except DISABLED represents the bandwidth of the filter in Hz.
*/
public enum GyroLPF {
public enum GyroLPF:Int8 {
case BW_250
case BW_184
case BW_92
Expand All @@ -73,7 +84,7 @@ public class ESenseConfig: NSObject {
case BW_3600
case DISABLED

static let values = [BW_250, BW_184, BW_92, BW_41, BW_20, BW_10, BW_5, BW_3600, DISABLED]
public static let values = [BW_250, BW_184, BW_92, BW_41, BW_20, BW_10, BW_5, BW_3600, DISABLED]

func ordinal() -> Int{
return ordinal(self)
Expand All @@ -87,12 +98,17 @@ public class ESenseConfig: NSObject {
}
return 0
}

public var label:String {
let labels = ["BW_250", "BW_184", "BW_92", "BW_41", "BW_20", "BW_10", "BW_5", "BW_3600", "DISABLED"]
return labels[ordinal(self)]
}
}

/**
* Accelerometer low pass filter configuration. Each value except DISABLED represents the bandwidth of the filter in Hz.
*/
public enum AccLPF {
public enum AccLPF:Int8 {
case BW_460
case BW_184
case BW_92
Expand All @@ -102,7 +118,7 @@ public class ESenseConfig: NSObject {
case BW_5
case DISABLED

static let values = [BW_460, BW_184, BW_92, BW_41, BW_20, BW_10, BW_5, DISABLED]
public static let values = [BW_460, BW_184, BW_92, BW_41, BW_20, BW_10, BW_5, DISABLED]

func ordinal() -> Int{
return ordinal(self)
Expand All @@ -116,6 +132,11 @@ public class ESenseConfig: NSObject {
}
return 0
}

public var label:String {
let labels = ["BW_460", "BW_184", "BW_92", "BW_41", "BW_20", "BW_10", "BW_5", "DISABLED"]
return labels[ordinal(self)]
}
}

private var gyroRange:GyroRange
Expand Down
4 changes: 4 additions & 0 deletions Example/ESense.xcodeproj/project.pbxproj
Expand Up @@ -8,6 +8,7 @@

/* Begin PBXBuildFile section */
4F4B8872230524D500173D19 /* CoreBluetooth.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F4B8871230524D500173D19 /* CoreBluetooth.framework */; };
4F4B8892230CDB5F00173D19 /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F4B8891230CDB5F00173D19 /* SettingsViewController.swift */; };
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD51AFB9204008FA782 /* AppDelegate.swift */; };
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 607FACD71AFB9204008FA782 /* ViewController.swift */; };
607FACDB1AFB9204008FA782 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 607FACD91AFB9204008FA782 /* Main.storyboard */; };
Expand All @@ -34,6 +35,7 @@
28ADEB38844F331E85C51ADF /* ESense.podspec */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; name = ESense.podspec; path = ../ESense.podspec; sourceTree = "<group>"; };
3D578273D7B9E5546BFA1404 /* README.md */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../README.md; sourceTree = "<group>"; };
4F4B8871230524D500173D19 /* CoreBluetooth.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreBluetooth.framework; path = System/Library/Frameworks/CoreBluetooth.framework; sourceTree = SDKROOT; };
4F4B8891230CDB5F00173D19 /* SettingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = "<group>"; };
607FACD01AFB9204008FA782 /* ESense_Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ESense_Example.app; sourceTree = BUILT_PRODUCTS_DIR; };
607FACD41AFB9204008FA782 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
607FACD51AFB9204008FA782 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -98,6 +100,7 @@
children = (
607FACD51AFB9204008FA782 /* AppDelegate.swift */,
607FACD71AFB9204008FA782 /* ViewController.swift */,
4F4B8891230CDB5F00173D19 /* SettingsViewController.swift */,
607FACD91AFB9204008FA782 /* Main.storyboard */,
607FACDC1AFB9204008FA782 /* Images.xcassets */,
607FACDE1AFB9204008FA782 /* LaunchScreen.xib */,
Expand Down Expand Up @@ -348,6 +351,7 @@
files = (
607FACD81AFB9204008FA782 /* ViewController.swift in Sources */,
607FACD61AFB9204008FA782 /* AppDelegate.swift in Sources */,
4F4B8892230CDB5F00173D19 /* SettingsViewController.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
13 changes: 8 additions & 5 deletions Example/ESense/Base.lproj/Main.storyboard
Expand Up @@ -72,9 +72,9 @@
</constraints>
</view>
<navigationItem key="navigationItem" id="00a-JQ-eCx">
<barButtonItem key="rightBarButtonItem" systemItem="edit" id="rHq-gl-3Ul">
<barButtonItem key="rightBarButtonItem" image="settings" id="rHq-gl-3Ul">
<connections>
<segue destination="6i1-CW-dVe" kind="show" id="bxI-hQ-UmJ"/>
<segue destination="6i1-CW-dVe" kind="show" identifier="toSettings" id="bxI-hQ-UmJ"/>
</connections>
</barButtonItem>
</navigationItem>
Expand All @@ -89,10 +89,10 @@
</objects>
<point key="canvasLocation" x="1071.2" y="133.5832083958021"/>
</scene>
<!--Table View Controller-->
<!--Settings View Controller-->
<scene sceneID="XBm-jb-Csx">
<objects>
<tableViewController id="6i1-CW-dVe" sceneMemberID="viewController">
<tableViewController id="6i1-CW-dVe" customClass="SettingsViewController" customModule="ESense_Example" customModuleProvider="target" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" id="v8v-hU-ptJ">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
Expand All @@ -115,7 +115,7 @@
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="4Lw-cn-1Ng" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="2090" y="136"/>
<point key="canvasLocation" x="1926" y="134"/>
</scene>
<!--Navigation Controller-->
<scene sceneID="M7w-Ra-cTC">
Expand All @@ -136,4 +136,7 @@
<point key="canvasLocation" x="132" y="133.5832083958021"/>
</scene>
</scenes>
<resources>
<image name="settings" width="24" height="24"/>
</resources>
</document>
6 changes: 6 additions & 0 deletions Example/ESense/Images.xcassets/Contents.json
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
23 changes: 23 additions & 0 deletions Example/ESense/Images.xcassets/settings.imageset/Contents.json
@@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "settings.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "settings@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "settings@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e0b9ec6

Please sign in to comment.