RN41 Bluetooth Module Library
RN41 Bluetooth Module Library.
This library only contains the basic features, more will be implemented upon request
Diff: RN41.h
- Revision:
- 0:796e127c0dd1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RN41.h Wed Oct 28 15:48:39 2015 +0000 @@ -0,0 +1,51 @@ +#include "mbed.h" +#include <string> + +#ifndef RN41_H +#define RN41_H + +class RN41 { + +public: + + RN41(PinName tx, PinName rx); + + //Public Commands + bool reset(); + + //set commands + bool setDeviceName(string name); + bool setAuthenticationMode(int authMode); + bool setMode(int mode); //done + + //get commands + string getBluetoothAddress(); + bool getConnectionStatus(); + string getFirmwareVersion(); + + //action commands + bool connectToAddress(string address); + + //Message Mode + bool sendMessage(string message, char terminationChar); + string recieveMessage(char terminationChar); + +private: + //Vaiables + Serial _RN41; + int _baud; + bool _commandMode; + + //Private Commands + bool enterCommandMode(); + bool exitCommandMode(); + + //Send Data + void sendString(string msg); + bool readable(); + string getString(); + string getString(char terminationChar); + char getChar(); +}; + +#endif