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.
RN52.h@6:c454f88524d6, 2016-01-13 (annotated)
- Committer:
- petter
- Date:
- Wed Jan 13 22:11:50 2016 +0000
- Revision:
- 6:c454f88524d6
- Parent:
- 5:8e468fef2754
- Child:
- 7:2df2c6e8c0df
Updated rn52 implementation to correspond to 1.16 firmware; Reverted 0x61 response on Ibus
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
petter | 0:6cf6e566c0da | 1 | #ifndef RN52_H |
petter | 0:6cf6e566c0da | 2 | #define RN52_H |
petter | 0:6cf6e566c0da | 3 | |
petter | 6:c454f88524d6 | 4 | #define STRING_BUFFER_LENGTH 255 |
petter | 0:6cf6e566c0da | 5 | |
petter | 0:6cf6e566c0da | 6 | typedef enum |
petter | 0:6cf6e566c0da | 7 | { |
petter | 0:6cf6e566c0da | 8 | RN52_REBOOT, |
petter | 0:6cf6e566c0da | 9 | RN52_GETSTATUS, |
petter | 0:6cf6e566c0da | 10 | RN52_ASSISTANT, |
petter | 0:6cf6e566c0da | 11 | RN52_CALLER_ID, |
petter | 0:6cf6e566c0da | 12 | RN52_TRACK_METADATA, |
petter | 0:6cf6e566c0da | 13 | |
petter | 0:6cf6e566c0da | 14 | RN52_COMMAND_LAST |
petter | 0:6cf6e566c0da | 15 | |
petter | 0:6cf6e566c0da | 16 | } RN52_COMMAND; |
petter | 0:6cf6e566c0da | 17 | |
petter | 0:6cf6e566c0da | 18 | |
petter | 0:6cf6e566c0da | 19 | typedef enum |
petter | 0:6cf6e566c0da | 20 | { |
petter | 0:6cf6e566c0da | 21 | RN52_LIMBO, |
petter | 0:6cf6e566c0da | 22 | RN52_CONNECTABLE, |
petter | 0:6cf6e566c0da | 23 | RN52_CONNECTABLE_DISCOVERABLE, |
petter | 0:6cf6e566c0da | 24 | RN52_CONNECTED, |
petter | 0:6cf6e566c0da | 25 | RN52_OUTGOING_CALL, |
petter | 0:6cf6e566c0da | 26 | RN52_INCOMING_CALL, |
petter | 0:6cf6e566c0da | 27 | RN52_ACTIVE_CALL, |
petter | 0:6cf6e566c0da | 28 | RN52_TEST_MODE, |
petter | 0:6cf6e566c0da | 29 | RN52_THREE_WAY_CALL_WAITING, |
petter | 0:6cf6e566c0da | 30 | RN52_THREE_WAY_CALL_ON_HOLD, |
petter | 0:6cf6e566c0da | 31 | RN52_THREE_WAY_CALL_MULTI_CALL, |
petter | 2:10c60edc8573 | 32 | RN52_INCOMING_CALL_ON_HOLD, |
petter | 0:6cf6e566c0da | 33 | RN52_ACTIVE_CALL2, |
petter | 0:6cf6e566c0da | 34 | RN52_AUDIO_STREAMING, |
petter | 0:6cf6e566c0da | 35 | RN52_LOW_BATTERY, |
petter | 0:6cf6e566c0da | 36 | |
petter | 0:6cf6e566c0da | 37 | RN52_CONNECTION_LAST |
petter | 0:6cf6e566c0da | 38 | |
petter | 0:6cf6e566c0da | 39 | } RN52_CONNECTION; |
petter | 0:6cf6e566c0da | 40 | |
petter | 0:6cf6e566c0da | 41 | |
petter | 0:6cf6e566c0da | 42 | typedef enum |
petter | 0:6cf6e566c0da | 43 | { |
petter | 0:6cf6e566c0da | 44 | RN52_NO_EVENT, |
petter | 0:6cf6e566c0da | 45 | RN52_CALLER_ID_EVENT, |
petter | 0:6cf6e566c0da | 46 | RN52_TRACK_CHANGE_EVENT, |
petter | 0:6cf6e566c0da | 47 | |
petter | 0:6cf6e566c0da | 48 | RN52_EVENT_LAST |
petter | 0:6cf6e566c0da | 49 | |
petter | 0:6cf6e566c0da | 50 | } RN52_EVENT; |
petter | 0:6cf6e566c0da | 51 | |
petter | 0:6cf6e566c0da | 52 | typedef struct |
petter | 0:6cf6e566c0da | 53 | { |
petter | 0:6cf6e566c0da | 54 | RN52_EVENT event; |
petter | 0:6cf6e566c0da | 55 | bool media_connected; |
petter | 0:6cf6e566c0da | 56 | bool phone_connected; |
petter | 0:6cf6e566c0da | 57 | RN52_CONNECTION connection; |
petter | 6:c454f88524d6 | 58 | char title[STRING_BUFFER_LENGTH]; |
petter | 6:c454f88524d6 | 59 | char artist[STRING_BUFFER_LENGTH]; |
petter | 6:c454f88524d6 | 60 | char album[STRING_BUFFER_LENGTH]; |
petter | 6:c454f88524d6 | 61 | char genre[STRING_BUFFER_LENGTH]; |
petter | 6:c454f88524d6 | 62 | int duration; |
petter | 6:c454f88524d6 | 63 | int track_number; |
petter | 6:c454f88524d6 | 64 | int track_count; |
petter | 6:c454f88524d6 | 65 | char response[STRING_BUFFER_LENGTH]; |
petter | 0:6cf6e566c0da | 66 | |
petter | 0:6cf6e566c0da | 67 | } RN52_RESULT; |
petter | 0:6cf6e566c0da | 68 | |
petter | 0:6cf6e566c0da | 69 | |
petter | 0:6cf6e566c0da | 70 | |
petter | 0:6cf6e566c0da | 71 | |
petter | 0:6cf6e566c0da | 72 | //---------------------------------------------------------------------------- |
petter | 0:6cf6e566c0da | 73 | // CLASS |
petter | 0:6cf6e566c0da | 74 | //---------------------------------------------------------------------------- |
petter | 0:6cf6e566c0da | 75 | |
petter | 0:6cf6e566c0da | 76 | class RN52 |
petter | 0:6cf6e566c0da | 77 | { |
petter | 0:6cf6e566c0da | 78 | public: |
petter | 0:6cf6e566c0da | 79 | void init(); |
petter | 4:3041a571b7a7 | 80 | bool check_event(RN52_RESULT * rn52_result); |
petter | 5:8e468fef2754 | 81 | bool connect(); |
petter | 5:8e468fef2754 | 82 | bool disconnect(); |
petter | 5:8e468fef2754 | 83 | bool next_track(); |
petter | 5:8e468fef2754 | 84 | bool prev_track(); |
petter | 5:8e468fef2754 | 85 | bool toggle_play(); |
petter | 5:8e468fef2754 | 86 | bool maxvolume(); |
petter | 0:6cf6e566c0da | 87 | bool get(RN52_COMMAND cmd, RN52_RESULT * rn52_result); |
petter | 5:8e468fef2754 | 88 | bool capture_response(char * str); |
petter | 6:c454f88524d6 | 89 | void clear_serial(); |
petter | 0:6cf6e566c0da | 90 | }; |
petter | 0:6cf6e566c0da | 91 | |
petter | 0:6cf6e566c0da | 92 | #endif |