sdasd
Dependencies: BLE_API mbed nRF51822
Fork of MEDRON_SNIFFER_ABCD-KIMLIKLI-OLANLARI-TARAMA-YAPAR_30062016 by
Diff: main.cpp
- Revision:
- 12:f4b869da449c
- Parent:
- 11:16f67d5752e1
- Child:
- 13:5f87b9cdeb6f
diff -r 16f67d5752e1 -r f4b869da449c main.cpp --- a/main.cpp Tue Jan 12 10:20:26 2016 +0000 +++ b/main.cpp Fri Mar 18 15:30:12 2016 +0000 @@ -17,10 +17,12 @@ #include "mbed.h" #include "toolchain.h" #include "ble/BLE.h" -#include "TMP_nrf51/TMP_nrf51.h" + +//ABCD bir kimlik olarak belirlenir ve şifre vazifsedi görür herhangi bir bluetooth modülü ABCD içerirse burada görülecektir. DigitalOut alivenessLED(LED1, 1); Ticker ticker; +Serial pc(TX_PIN_NUMBER, RX_PIN_NUMBER); void periodicCallback(void) { @@ -41,10 +43,10 @@ struct ApplicationData_t { uint16_t applicationSpecificId; /* An ID used to identify temperature value in the manufacture specific AD data field */ - TMP_nrf51::TempSensorValue_t tmpSensorValue; /* User defined application data */ + //TMP_nrf51::TempSensorValue_t tmpSensorValue; /* User defined application data */ } PACKED; - static const uint16_t APP_SPECIFIC_ID_TEST = 0xFEFE; + static const uint16_t MED_KIMLIK = 0xABCD; /* Search for the manufacturer specific data with matching application-ID */ AdvertisingData_t *pAdvData; @@ -53,10 +55,21 @@ pAdvData = (AdvertisingData_t *)¶ms->advertisingData[index]; if (pAdvData->dataType == GapAdvertisingData::MANUFACTURER_SPECIFIC_DATA) { ApplicationData_t *pAppData = (ApplicationData_t *)pAdvData->data; - if (pAppData->applicationSpecificId == APP_SPECIFIC_ID_TEST) { + if (pAppData->applicationSpecificId == MED_KIMLIK) { /* dump information on the console. */ - printf("From [%02x %02x %02x], ", params->peerAddr[2], params->peerAddr[1], params->peerAddr[0]); - printf("Temp is %f\r\n", (TMP_nrf51::TempSensorValue_t)pAppData->tmpSensorValue); + + pc.printf("%02x%02x",0xFA,0xCC);//BASLANGIC BİTLERİ + //MAC adresi, RSSI + pc.printf("%02x%02x%02x%02x%02x%02x%d", + params->peerAddr[5], params->peerAddr[4], params->peerAddr[3], params->peerAddr[2], params->peerAddr[1], params->peerAddr[0],params->rssi); + pc.printf("%02x", params->advertisingDataLen);// AdvDATA UZUNLUGU + for (unsigned index = 0; index < params->advertisingDataLen; index++) { + pc.printf("%02x", params->advertisingData[index]); + } + pc.printf("%02x\r",0xFF);// BITIS + + //printf("From [%02x %02x %02x], ", params->peerAddr[2], params->peerAddr[1], params->peerAddr[0]); + //printf("Temp is %f\r\n", (TMP_nrf51::TempSensorValue_t)pAppData->tmpSensorValue); break; } } @@ -92,14 +105,24 @@ } /* Setup and start scanning */ - ble.gap().setScanParams(1800 /* scan interval */, 1500 /* scan window */); + ble.gap().setScanParams(1800 /* scan interval */, 100 /* scan window */); ble.gap().startScan(advertisementCallback); } int main(void) { + pc.baud(9600); //local terminal baud ticker.attach(periodicCallback, 1); /* trigger sensor polling every 2 seconds */ + for(uint8_t say=0; say<5; say++ ) + { + wait(1); + pc.printf("wifi_id=AndroidAP|<>|pass=duqy0286"); + pc.printf("\r"); + + } + + BLE &ble = BLE::Instance(); ble.init(bleInitComplete);