chromium/out/Default/gen/extensions/common/api/usb.h

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// GENERATED FROM THE API DEFINITION IN
//   extensions/common/api/usb.idl
// by tools/json_schema_compiler.
// DO NOT EDIT.

#ifndef EXTENSIONS_COMMON_API_USB_H__
#define EXTENSIONS_COMMON_API_USB_H__

#include <stdint.h>

#include <map>
#include <memory>
#include <optional>
#include <string>
#include <vector>

#include "base/values.h"
#include <string_view>


namespace extensions {
namespace api {
namespace usb {

//
// Types
//

// Direction, Recipient, RequestType, and TransferType all map to their
// namesakes within the USB specification.
enum class Direction {};


const char* ToString(Direction as_enum);
Direction ParseDirection(std::string_view as_string);
std::u16string GetDirectionParseError(std::string_view as_string);

enum class Recipient {};


const char* ToString(Recipient as_enum);
Recipient ParseRecipient(std::string_view as_string);
std::u16string GetRecipientParseError(std::string_view as_string);

enum class RequestType {};


const char* ToString(RequestType as_enum);
RequestType ParseRequestType(std::string_view as_string);
std::u16string GetRequestTypeParseError(std::string_view as_string);

enum class TransferType {};


const char* ToString(TransferType as_enum);
TransferType ParseTransferType(std::string_view as_string);
std::u16string GetTransferTypeParseError(std::string_view as_string);

// For interrupt and isochronous modes, SynchronizationType and UsageType map to
// their namesakes within the USB specification.
enum class SynchronizationType {};


const char* ToString(SynchronizationType as_enum);
SynchronizationType ParseSynchronizationType(std::string_view as_string);
std::u16string GetSynchronizationTypeParseError(std::string_view as_string);

enum class UsageType {};


const char* ToString(UsageType as_enum);
UsageType ParseUsageType(std::string_view as_string);
std::u16string GetUsageTypeParseError(std::string_view as_string);

struct Device {};

struct ConnectionHandle {};

struct EndpointDescriptor {};

struct InterfaceDescriptor {};

struct ConfigDescriptor {};

struct ControlTransferInfo {};

struct GenericTransferInfo {};

struct IsochronousTransferInfo {};

struct TransferResultInfo {};

struct DeviceFilter {};

struct EnumerateDevicesOptions {};

struct EnumerateDevicesAndRequestAccessOptions {};

struct DevicePromptOptions {};


//
// Functions
//

namespace GetDevices {

struct Params {};

namespace Results {

base::Value::List Create(const std::vector<Device>& devices);
}  // namespace Results

}  // namespace GetDevices

namespace GetUserSelectedDevices {

struct Params {};

namespace Results {

base::Value::List Create(const std::vector<Device>& devices);
}  // namespace Results

}  // namespace GetUserSelectedDevices

namespace GetConfigurations {

struct Params {};

namespace Results {

base::Value::List Create(const std::vector<ConfigDescriptor>& configs);
}  // namespace Results

}  // namespace GetConfigurations

namespace RequestAccess {

struct Params {};

namespace Results {

base::Value::List Create(bool success);
}  // namespace Results

}  // namespace RequestAccess

namespace OpenDevice {

struct Params {};

namespace Results {

base::Value::List Create(const ConnectionHandle& handle);
}  // namespace Results

}  // namespace OpenDevice

namespace FindDevices {

struct Params {};

namespace Results {

base::Value::List Create(const std::vector<ConnectionHandle>& handles);
}  // namespace Results

}  // namespace FindDevices

namespace CloseDevice {

struct Params {};

namespace Results {

base::Value::List Create();
}  // namespace Results

}  // namespace CloseDevice

namespace SetConfiguration {

struct Params {};

namespace Results {

base::Value::List Create();
}  // namespace Results

}  // namespace SetConfiguration

namespace GetConfiguration {

struct Params {};

namespace Results {

base::Value::List Create(const ConfigDescriptor& config);
}  // namespace Results

}  // namespace GetConfiguration

namespace ListInterfaces {

struct Params {};

namespace Results {

base::Value::List Create(const std::vector<InterfaceDescriptor>& descriptors);
}  // namespace Results

}  // namespace ListInterfaces

namespace ClaimInterface {

struct Params {};

namespace Results {

base::Value::List Create();
}  // namespace Results

}  // namespace ClaimInterface

namespace ReleaseInterface {

struct Params {};

namespace Results {

base::Value::List Create();
}  // namespace Results

}  // namespace ReleaseInterface

namespace SetInterfaceAlternateSetting {

struct Params {};

namespace Results {

base::Value::List Create();
}  // namespace Results

}  // namespace SetInterfaceAlternateSetting

namespace ControlTransfer {

struct Params {};

namespace Results {

base::Value::List Create(const TransferResultInfo& info);
}  // namespace Results

}  // namespace ControlTransfer

namespace BulkTransfer {

struct Params {};

namespace Results {

base::Value::List Create(const TransferResultInfo& info);
}  // namespace Results

}  // namespace BulkTransfer

namespace InterruptTransfer {

struct Params {};

namespace Results {

base::Value::List Create(const TransferResultInfo& info);
}  // namespace Results

}  // namespace InterruptTransfer

namespace IsochronousTransfer {

struct Params {};

namespace Results {

base::Value::List Create(const TransferResultInfo& info);
}  // namespace Results

}  // namespace IsochronousTransfer

namespace ResetDevice {

struct Params {};

namespace Results {

base::Value::List Create(bool success);
}  // namespace Results

}  // namespace ResetDevice

//
// Events
//

namespace OnDeviceAdded {

extern const char kEventName[];  // "usb.onDeviceAdded"

base::Value::List Create(const Device& device);
}  // namespace OnDeviceAdded

namespace OnDeviceRemoved {

extern const char kEventName[];  // "usb.onDeviceRemoved"

base::Value::List Create(const Device& device);
}  // namespace OnDeviceRemoved

}  // namespace usb
}  // namespace api
}  // namespace extensions

#endif  // EXTENSIONS_COMMON_API_USB_H__