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

Fork of Hexi_KW40Z by Hexiwear

Revision:
3:9e92f113c671
Parent:
2:bb66c19c3c04
Child:
4:8586f50385d2
Child:
5:8c7c1cc024ed
--- a/Hexi_KW40Z.cpp	Mon Sep 19 05:45:31 2016 +0000
+++ b/Hexi_KW40Z.cpp	Tue Sep 20 01:04:31 2016 +0000
@@ -68,6 +68,7 @@
     activeTsiGroup = 0;
     advertisementMode = 0;
     linkState = 0;
+    bondPassKey = 0;
     
     /* intialization finalized, signal to start the threads */
     mainThread.signal_set(START_THREAD);
@@ -105,12 +106,12 @@
     pc.printf("MainTask Stared\r\n");
 #endif
 
-#if 0
+
     SendGetActiveTsiGroup();
     SendGetAdvertisementMode();
     SendGetLinkState();
     SendGetVersion();
-#endif
+
 
     while(1)
     {
@@ -351,7 +352,11 @@
         
         /* Passkey for pairing received */
         case packetType_passDisplay:
-            if(passkeyCb != NULL) passkeyCb(&rxPacket->data[0]);
+            if(passkeyCb != NULL)
+            {
+                memcpy((uint8_t *)&bondPassKey,&rxPacket->data[0], 3);
+                passkeyCb();
+            }
             break;
             
         /* OTAP messages */
@@ -513,7 +518,7 @@
     SendPacket(&txPacket, true);
 }
 
-void KW40Z::SendHearRate(uint8_t rate)
+void KW40Z::SendHeartRate(uint8_t rate)
 {
     hostInterface_packet_t txPacket = {0};
     
@@ -676,3 +681,14 @@
     
     SendPacket(&txPacket, false);    
 }
+
+uint8_t KW40Z::GetAdvertisementMode(void)
+{
+    return advertisementMode;
+}
+
+uint32_t KW40Z::GetPassKey(void)
+{
+    return bondPassKey;
+}
+