Skip to content

Third-party .NET library to read raw sensor data from the cosinuss° One Bluetooth earables.

License

Notifications You must be signed in to change notification settings

TobiasRoeddiger/cosinuss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cosinuss° One Library

Build Passing Open Issues Twitter Tobias Röddiger

Third-party .NET library to read raw sensor data from the cosinuss° One Bluetooth earables (work in progress). NuGet publication pending.

Feature Supported BLE GATT API Reference
Device Information [1]
Heart Rate [1]
Body Temperature [1]
Sensor Quality [2]
Step Frequency [2]
Accelerometer X, Y, Z 🚧 [2]
PPG Green 🚧 [2]
PPG Red 🚧 [2]
Ambient Light 🚧 [2]

[1] Bluetooth SIG, Generic Attribute Profile (GATT), January 2020, URL

[2] Reverse-engineered funcationalities. Use with caution and at your own risk! Correct functionality not guranteed.

[3] Röddiger, Tobias, et al. "Towards Respiration Rate Monitoring Using an In-Ear Headphone Inertial Measurement Unit" International Joint Conference on Pervasive and Ubiquitous Computing (Ubicomp'19), 1st International Workshop on Earable Computing Systems. ACM, 2019.

Sample App

Supported Platforms

  • .NET Standard
  • Android 4.3+
  • iOS 7+
  • tvOS
  • macOS
  • UWP

Setup

Android

Add the following to your AndroidManifest.xml PLEASE NOTE THAT YOU HAVE TO REQUEST THESE PERMISSIONS USING Activity.RequestPermission or a Plugin. The example app includes an implementation for the Permissions Plugin.

<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>

<!--this is necessary for Android v6+ to get the device name and address-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

iOS

To use the cosinuss device as a background BLE periperhal, add the following to your Info.plist

<key>UIBackgroundModes</key>
<array>
    <!--for connecting to devices (client)-->
	<string>bluetooth-central</string>

    <!--for server configurations if needed-->
	<string>bluetooth-peripheral</string>
</array>

<!--To add a description to the Bluetooth request message (on iOS 10 this is required!)-->
<key>NSBluetoothPeripheralUsageDescription</key>
<string>YOUR CUSTOM MESSAGE</string>

Usage

// TODO: ensure permissions are granted as shown in the previous section of the README

Cosinuss.Library.Cross.Current.OnDeviceFound += Current_OnDeviceFound;
Cosinuss.Library.Cross.Current.StartScanning();

void Current_OnDeviceFound(object sender, ICosinussDevice cosinussDevice)
{
    // stop scanning before connecting to avoid any issues
    Cosinuss.Library.Cross.Current.StopScanning();
    Cosinuss.Library.Cross.Current.OnDeviceFound -= Current_OnDeviceFound; // deregister event handlers

    // connect to the cosinuss device
    cosinussDevice.OnConnectionStateChanged += CosinussDevice_OnConnectionStateChanged;
    cosinussDevice.Connect();    
}

private void CosinussDevice_OnConnectionStateChanged(object sender, ConnectionState e)
{
    var cosinussDevice = (ICosinussDevice)sender;

    if (e == ConnectionState.CONNECTED)
    {
	cosinussDevice.BatteryLevelChanged += CosinussDevice_BatteryLevelChanged;
    	cosinussDevice.SensorQualityIndexChanged += CosinussDevice_DataQualityIndexChanged;

    	cosinussDevice.BodyTemperatureChanged += CosinussDevice_BodyTemperatureChanged;
    	cosinussDevice.HeartRateChanged += CosinussDevice_HeartRateChanged;
    	cosinussDevice.SPO2Changed += CosinussDevice_SPO2Changed;
	cosinussDevice.AccelerometerChanged += CosinussDevice_AccelerometerChanged;
    }
}

About

Third-party .NET library to read raw sensor data from the cosinuss° One Bluetooth earables.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages