1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef SERVICES_DEVICE_SERIAL_SERIAL_DEVICE_ENUMERATOR_H_
6 #define SERVICES_DEVICE_SERIAL_SERIAL_DEVICE_ENUMERATOR_H_
12 #include "base/optional.h"
13 #include "services/device/public/mojom/serial.mojom.h"
14 #include "services/device/serial/serial_io_handler.h"
22 // Discovers and enumerates serial devices available to the host.
23 class SerialDeviceEnumerator {
25 using TokenPathMap = std::map<base::UnguessableToken, base::FilePath>;
27 static std::unique_ptr<SerialDeviceEnumerator> Create();
29 SerialDeviceEnumerator();
30 virtual ~SerialDeviceEnumerator();
32 virtual std::vector<mojom::SerialPortInfoPtr> GetDevices() = 0;
34 base::Optional<base::FilePath> GetPathFromToken(
35 const base::UnguessableToken& token);
38 const base::UnguessableToken& GetTokenFromPath(const base::FilePath& path);
41 TokenPathMap token_path_map_;
46 #endif // SERVICES_DEVICE_SERIAL_SERIAL_DEVICE_ENUMERATOR_H_