Simulated the CD changer of a Saab to implement a bluetooth connection to the car stereo. Control of playback device (phone) with steering wheel buttons. Needs a RN52 bluetooth transciever and a CAN transiever. So far only audio playback and control via steering wheel buttons implemented. Hands free calling planned.

Dependencies:   mbed

Revision:
0:6cf6e566c0da
Child:
2:10c60edc8573
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RN52.h	Mon Jan 04 15:31:12 2016 +0000
@@ -0,0 +1,85 @@
+#ifndef RN52_H
+#define RN52_H
+
+
+typedef enum
+{
+    RN52_PLAYPAUSE,
+    RN52_NEXTTRACK,
+    RN52_PREVTRACK,
+    RN52_CONNECT,
+    RN52_DISCONNECT,
+    RN52_REBOOT,
+    RN52_VOLUMEUP,
+    RN52_MAXVOLUME,
+    RN52_GETSTATUS,
+    RN52_ASSISTANT,
+    RN52_CALLER_ID,
+    RN52_TRACK_METADATA,
+
+    RN52_COMMAND_LAST
+  
+} RN52_COMMAND;
+
+
+typedef enum
+{
+    RN52_LIMBO,
+    RN52_CONNECTABLE,
+    RN52_CONNECTABLE_DISCOVERABLE,
+    RN52_CONNECTED,
+    RN52_OUTGOING_CALL,
+    RN52_INCOMING_CALL,
+    RN52_ACTIVE_CALL,
+    RN52_TEST_MODE,
+    RN52_THREE_WAY_CALL_WAITING,
+    RN52_THREE_WAY_CALL_ON_HOLD,
+    RN52_THREE_WAY_CALL_MULTI_CALL,
+    RN52_ACTIVE_CALL2,
+    RN52_AUDIO_STREAMING,
+    RN52_LOW_BATTERY,
+
+    RN52_CONNECTION_LAST
+  
+} RN52_CONNECTION;
+
+
+typedef enum
+{
+    RN52_NO_EVENT,
+    RN52_OTHER_EVENT,
+    RN52_CALLER_ID_EVENT,
+    RN52_TRACK_CHANGE_EVENT,
+
+    RN52_EVENT_LAST
+  
+} RN52_EVENT;
+
+typedef struct
+{
+    RN52_EVENT event;
+    bool media_connected;
+    bool phone_connected;
+    RN52_CONNECTION connection;
+    char response[40];
+    
+} RN52_RESULT;
+
+
+
+
+//----------------------------------------------------------------------------
+// CLASS
+//----------------------------------------------------------------------------
+
+class RN52
+{
+public:
+    void init();
+    bool changed();
+    bool set(RN52_COMMAND cmd);
+    bool get(RN52_COMMAND cmd, RN52_RESULT * rn52_result);  
+    void capture_response(char * str);
+};
+
+#endif
\ No newline at end of file