Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of Hexi_KW40Z by
Revision 3:9e92f113c671, committed 2016-09-20
- Comitter:
- khuang
- Date:
- Tue Sep 20 01:04:31 2016 +0000
- Parent:
- 2:bb66c19c3c04
- Child:
- 4:8586f50385d2
- Child:
- 5:8c7c1cc024ed
- Commit message:
- Altered case for packetType_passDiplay. Bonding Passkey now accessible through GetPassKey() function.
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 |
--- 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;
+}
+
--- a/Hexi_KW40Z.h Mon Sep 19 05:45:31 2016 +0000
+++ b/Hexi_KW40Z.h Tue Sep 20 01:04:31 2016 +0000
@@ -154,7 +154,8 @@
typedef void (*button_t)(void);
typedef void (*alert_t)(uint8_t *data, uint8_t length);
-typedef void (*passkey_t)(uint8_t *data);
+//typedef void (*passkey_t)(uint8_t *data);
+typedef void (*passkey_t)(void);
typedef void (*notifications_t)(uint8_t eventId, uint8_t categoryId);
typedef struct name
@@ -200,7 +201,7 @@
void SendTemperature(uint16_t celsius);
void SendHumidity(uint16_t percentage);
void SendPressure(uint16_t pascal);
- void SendHearRate(uint8_t rate);
+ void SendHeartRate(uint8_t rate);
void SendSteps(uint16_t steps);
void SendCalories(uint16_t calories);
void SendAlert(uint8_t *pData, uint8_t length);
@@ -213,6 +214,12 @@
uint8_t GetAdvertisementMode(void);
uint8_t GetLinkState(void);
hexiwear_version_t GetVersion(void);
+
+ uint32_t GetPassKey(void);
+
+
+
+
private:
RawSerial device;
@@ -239,6 +246,7 @@
uint8_t activeTsiGroup;
uint8_t advertisementMode;
uint8_t linkState;
+ uint32_t bondPassKey;
MemoryPool<hostInterface_packet_t, 16> mpool;
Queue<hostInterface_packet_t, 16> queue;
