L0_BlueNRG_Test_Client

Dependencies:   BLE_API BLE_BlueNRG mbed

Fork of L0_BlueNRG_Test by Mridupawan Das

main.cpp

Committer:
Deepti
Date:
2014-11-20
Revision:
4:17e1861df93f
Parent:
2:cf54be3a9e6a

File content as of revision 4:17e1861df93f:

#include "mbed.h"


#include "debug.h"
#include "btle.h"
#include "BlueNRG_Master.h"


extern Serial  pc;
DigitalOut myled(LED1);
#define BDADDR_SIZE 6

//BlueNRG_Master dev;

uint8_t BlueNRG_Master::bdaddr[6]= { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
BlueNRG_Master dev;


int main()
{
    

    BlueNRG_Master::getInstance().btle_M_init(true);
    
    DEBUG(" Initialization completed\n ");
    
    ble_error_t error = BlueNRG_Master::getInstance().scan_ble_devices(0x4000, 0x4000,0x00,0x00);
    
   if(error == BLE_ERROR_NONE)
    {
        while(1)
        {
            DEBUG(" IN WHILE LOOP \n");
            myled = 1; // LED is ON
            wait(0.5); // 500 ms
            myled = 0; // LED is OFF
            wait(0.5); // 500 ms
            //DEBUG("tic!\n\r");
            BlueNRG_Master::getInstance().waitForEvent();
        } 
   }
    else
        DEBUG(" NO DEVICE DISCOVERED");
        
        //ble_error_t conn_error = BlueNRG_Master::create_connection(0x4000,0x4000, 0x00, BlueNRG_Master::bdaddr, 
                                                    //0x00, 0x0006,0x0028, 0x0000, 
                                                    //0x03E8, 0x0000, 0x03E8);        
        
        
        //ble_error_t disc_service_error = BlueNRG_Master::disc_all_prim_services(BlueNRG_Master::m_connectionHandle);
        
        //pc.printf("%u", disc_service_error);*/
        return 0;
        
}