summaryrefslogtreecommitdiff
path: root/src/Components/Ble/NimbleController.h
blob: c4eab52b41e2046c68e50c42b68f8dc2d3a0242e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#pragma once

#include <cstdint>
#include "AlertNotificationClient.h"
#include "DeviceInformationService.h"
#include "CurrentTimeClient.h"
#include <host/ble_gap.h>

namespace Pinetime {
  namespace Controllers {
    class DateTime;
    class NimbleController {
      public:
        NimbleController(Pinetime::System::SystemTask& systemTask, DateTime& dateTimeController, Pinetime::Controllers::NotificationManager& notificationManager);
        void Init();
        void StartAdvertising();
        int OnGAPEvent(ble_gap_event *event);

        int OnDiscoveryEvent(uint16_t i, const ble_gatt_error *pError, const ble_gatt_svc *pSvc);
      private:
        static constexpr char* deviceName = "Pinetime-JF";
        Pinetime::System::SystemTask& systemTask;
        DateTime& dateTimeController;
        Pinetime::Controllers::NotificationManager& notificationManager;

        DeviceInformationService deviceInformationService;
        CurrentTimeClient currentTimeClient;
        AlertNotificationClient alertNotificationClient;
        uint8_t addrType;
        uint16_t connectionHandle;
    };
  }
}