This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hizmet | Uniform Type ID | Numarası | |
---|---|---|---|
Battery Service | org.bluetooth.service.battery_service | 0x180F | |
Sensor Service | Standart değil! Kendimiz tanımladık | a62206b9-8cd9-4f02-ae53-1755928a54e1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hizmet | Karakteristik Özellik | Numarası | Çalışma Yöntemi | |
---|---|---|---|---|
Battery Service | Battery Level | 0x2A19 | READ | |
Sensor Service | Sensor Value | a62206b9-8cd9-4f02-ae53-1755928a54e2 | READ,NOTIFY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Karakteristik Özellik | Adı | Numarası | Tanım | |
---|---|---|---|---|
Battery Level | Characteristic User Description | 0x2901 | Seviye türü tanımı | |
Sensor Value | Client Characteristic Configuration | 0x2902 | NOTIFY yöntemini belirten tanım |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BLEServer *pServer; | |
BLEService *pBatteryService, *pSensorService; | |
BLECharacteristic *pBatteryLevelCharx, *pSensorValueCharx; | |
BLEDescriptor BatteryLevelDescriptor(BatteryLevelDescriptorUUID); | |
BLE2902 ble2902 = BLE2902(); //NOTIFY yöntemi tanımlayıcısı |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BaglantiCallback : public BLEServerCallbacks | |
{ | |
void onConnect(BLEServer* pServer, esp_ble_gatts_cb_param_t *param) { | |
Serial.print("Baglandi. ID: "); | |
Serial.print(param->connect.conn_id, DEC); | |
Serial.print(" client addr: "); | |
Serial.printf(ESP_BD_ADDR_STR | |
, (uint8_t)param->connect.remote_bda[0] | |
, (uint8_t)param->connect.remote_bda[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
... | |
... | |
BLEDevice::init("BizimBLE"); //cihazın görünen adı | |
pServer = BLEDevice::createServer(); | |
pServer->setCallbacks(new BaglantiCallback()); | |
//Hizmet oluştur |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void loop(){ | |
... | |
... | |
int pil_seviyesi_adc = analogRead(pil_olcum_pini); | |
uint8_t pil_seviyesi = map (pil_seviyesi_adc, 0, 4096, 0, 100); | |
pBatteryLevelCharx->setValue(&pil_seviyesi, 1); //sadece READ işlemi yapılacak | |
if( digitalRead(sensor_pin) == HIGH ) { | |
pSensorValueCharx->setValue("Acik"); | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@debian-s-9:~# apt update | |
... | |
root@debian-s-9:~# apt upgrade | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@debian-s-9:~# apt-get -y install postgresql | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@debian-s-9:~# apt-get -y install apt-transport-https | |
... |
OlderNewer