blob: 19c55b9b929cfb7d06d7a646b22559eb72008f25 [file] [log] [blame]
/*
* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <memory>
#include "hci/hci_packets.h"
#include "module.h"
#include "neighbor/scan_parameters.h"
namespace bluetooth {
namespace neighbor {
using PageTimeout = uint16_t; // Range = 0x0001 to 0xffff, Time N * 0.625ms
inline double PageTimeoutMs(PageTimeout timeout) {
return kTimeTickMs * timeout;
}
class PageModule : public bluetooth::Module {
public:
void SetScanActivity(ScanParameters params);
ScanParameters GetScanActivity() const;
void SetInterlacedScan();
void SetStandardScan();
void SetTimeout(PageTimeout timeout);
static const ModuleFactory Factory;
PageModule();
PageModule(const PageModule&) = delete;
PageModule& operator=(const PageModule&) = delete;
~PageModule();
protected:
void ListDependencies(ModuleList* list) const override;
void Start() override;
void Stop() override;
std::string ToString() const override {
return std::string("Page");
}
private:
struct impl;
std::unique_ptr<impl> pimpl_;
};
} // namespace neighbor
} // namespace bluetooth