RN41 Bluetooth Module Library

RN41 Bluetooth Module Library.

This library only contains the basic features, more will be implemented upon request

RN41.h

Committer:
NoLiver92
Date:
2015-10-28
Revision:
0:796e127c0dd1

File content as of revision 0:796e127c0dd1:

#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