Hexiwear library for communicating with the on-board KW40Z BLE device. KW40Z handles also the touch buttons.

Fork of Hexi_KW40Z by Hexiwear

Files at this revision

API Documentation at this revision

Comitter:
daveyclk
Date:
Wed Sep 28 10:46:19 2016 +0000
Parent:
5:8c7c1cc024ed
Commit message:
Added iBreathe BLE packet type, for use with custom iOS Hexiware App build

Changed in this revision

Hexi_KW40Z.cpp Show annotated file Show diff for this revision Revisions of this file
Hexi_KW40Z.h Show annotated file Show diff for this revision Revisions of this file
diff -r 8c7c1cc024ed -r 29fd3288676c Hexi_KW40Z.cpp
--- a/Hexi_KW40Z.cpp	Tue Sep 20 22:38:58 2016 +0000
+++ b/Hexi_KW40Z.cpp	Wed Sep 28 10:46:19 2016 +0000
@@ -504,6 +504,21 @@
     SendPacket(&txPacket, true);
 }
 
+//send iBreathe Data
+void KW40Z::SendiBreathe(uint16_t ppm)
+{
+    hostInterface_packet_t txPacket = {0};
+    
+    txPacket.start1     = gHostInterface_startByte1;
+    txPacket.start2     = gHostInterface_startByte2;
+    txPacket.type       = packetType_alc;
+    txPacket.length     = 2;
+    memcpy(&txPacket.data[0],(uint8_t*)&ppm,txPacket.length);
+    txPacket.data[2]    = gHostInterface_trailerByte;
+    
+    SendPacket(&txPacket, true);
+}
+
 void KW40Z::SendPressure(uint16_t pascal)
 {
     hostInterface_packet_t txPacket = {0};
@@ -518,33 +533,33 @@
     SendPacket(&txPacket, true);
 }
 
-void KW40Z::SendHeartRate(uint8_t rate)
-{
-    hostInterface_packet_t txPacket = {0};
+//void KW40Z::SendHeartRate(uint8_t rate)
+//{
+//    hostInterface_packet_t txPacket = {0};
+//    
+//    txPacket.start1     = gHostInterface_startByte1;
+//    txPacket.start2     = gHostInterface_startByte2;
+//    txPacket.type       = packetType_steps;
+//    txPacket.length     = 1;
+//    txPacket.data[0]    = rate;
+//   txPacket.data[1]    = gHostInterface_trailerByte;
     
-    txPacket.start1     = gHostInterface_startByte1;
-    txPacket.start2     = gHostInterface_startByte2;
-    txPacket.type       = packetType_steps;
-    txPacket.length     = 1;
-    txPacket.data[0]    = rate;
-    txPacket.data[1]    = gHostInterface_trailerByte;
-    
-    SendPacket(&txPacket, true);
-}
+//    SendPacket(&txPacket, true);
+//}
 
-void KW40Z::SendSteps(uint16_t steps)
-{
-    hostInterface_packet_t txPacket = {0};
-    
-    txPacket.start1     = gHostInterface_startByte1;
-    txPacket.start2     = gHostInterface_startByte2;
-    txPacket.type       = packetType_steps;
-    txPacket.length     = 2;
-    memcpy(&txPacket.data[0],(uint8_t*)&steps,txPacket.length);
-    txPacket.data[2]    = gHostInterface_trailerByte;
-    
-    SendPacket(&txPacket, true);
-}
+//void KW40Z::SendSteps(uint16_t steps)
+//{
+//    hostInterface_packet_t txPacket = {0};
+//    
+//    txPacket.start1     = gHostInterface_startByte1;
+//    txPacket.start2     = gHostInterface_startByte2;
+//    txPacket.type       = packetType_steps;
+//    txPacket.length     = 2;
+//    memcpy(&txPacket.data[0],(uint8_t*)&steps,txPacket.length);
+//    txPacket.data[2]    = gHostInterface_trailerByte;
+//    
+//    SendPacket(&txPacket, true);
+//}
 
 void KW40Z::SendCalories(uint16_t calories)
 {
diff -r 8c7c1cc024ed -r 29fd3288676c Hexi_KW40Z.h
--- a/Hexi_KW40Z.h	Tue Sep 20 22:38:58 2016 +0000
+++ b/Hexi_KW40Z.h	Wed Sep 28 10:46:19 2016 +0000
@@ -74,7 +74,7 @@
     
     packetType_accel            = 6, /**< motion service */
     packetType_ambiLight        = 7, /**< weather service */
-    packetType_pressure         = 8, /**< weather service */
+    packetType_pressure         = 8, /**< weather service */ 
     
     
     packetType_gyro             = 9,  /**< motion service */
@@ -82,9 +82,10 @@
     packetType_humidity         = 11, /**< weather service */
     packetType_magnet           = 12, /**< motion service */
     
-    packetType_heartRate        = 13, /**< health service */
-    packetType_steps            = 14, /**< health service */
+ //   packetType_heartRate        = 13, /**< health service */
+ //   packetType_steps            = 14, /**< health service */
     packetType_calories         = 15, /**< health service */
+    packetType_alc              = 14, /* add ibreathe packet identifier*/
     
     /* Alert Service */
     packetType_alertIn          = 16, /**<  incoming alerts */
@@ -201,6 +202,8 @@
     void SendTemperature(uint16_t celsius);
     void SendHumidity(uint16_t percentage);
     void SendPressure(uint16_t pascal);
+    // add iBreathe
+    void SendiBreathe(uint16_t ppm);
     void SendHeartRate(uint8_t rate);
     void SendSteps(uint16_t steps);
     void SendCalories(uint16_t calories);