import "common_base.proto";

message CBluetoothManager_CancelPair_Request {
	optional uint32 device = 1;
}

message CBluetoothManager_CancelPair_Response {
}

message CBluetoothManager_Connect_Request {
	optional uint32 device = 1;
}

message CBluetoothManager_Connect_Response {
}

message CBluetoothManager_Disconnect_Request {
	optional uint32 device = 1;
}

message CBluetoothManager_Disconnect_Response {
}

message CBluetoothManager_Forget_Request {
	optional uint32 device = 1;
}

message CBluetoothManager_Forget_Response {
}

message CBluetoothManager_GetAdapterDetails_Request {
	optional uint32 id = 1;
}

message CBluetoothManager_GetAdapterDetails_Response {
	optional .CMsgBluetoothManagerAdapterDetails adapter = 1;
}

message CBluetoothManager_GetDeviceDetails_Request {
	optional uint32 id = 1;
}

message CBluetoothManager_GetDeviceDetails_Response {
	optional .CMsgBluetoothManagerDeviceDetails device = 1;
}

message CBluetoothManager_GetState_Request {
}

message CBluetoothManager_GetState_Response {
	optional bool is_service_available = 1;
	optional bool is_enabled = 2;
	optional bool is_discovering = 3;
	repeated .CMsgBluetoothManagerAdapterInfo adapters = 4;
	repeated .CMsgBluetoothManagerDeviceInfo devices = 5;
}

message CBluetoothManager_Pair_Request {
	optional uint32 device = 1;
}

message CBluetoothManager_Pair_Response {
}

message CBluetoothManager_SetDiscovering_Request {
	optional bool enabled = 1;
}

message CBluetoothManager_SetDiscovering_Response {
}

message CBluetoothManager_SetLoginAdvertising_Request {
	optional bool enabled = 1;
	optional uint64 client_id = 2;
	optional uint32 device_id = 3;
}

message CBluetoothManager_SetLoginAdvertising_Response {
}

message CBluetoothManager_SetTrusted_Request {
	optional uint32 device = 1;
	optional bool trusted = 2;
}

message CBluetoothManager_SetTrusted_Response {
}

message CBluetoothManager_SetWakeAllowed_Request {
	optional uint32 device = 1;
	optional bool allowed = 2;
}

message CBluetoothManager_SetWakeAllowed_Response {
}

message CBluetoothManager_StateChanged_Notification {
}

message CMsgBluetoothManagerAdapterDetails {
	optional uint32 id = 1 [default = 0];
	optional string mac = 2;
	optional string name = 3;
	optional bool is_enabled = 4;
	optional bool is_discovering = 5;
}

message CMsgBluetoothManagerAdapterInfo {
	optional uint32 id = 1;
}

message CMsgBluetoothManagerDeviceDetails {
	optional uint32 id = 1 [default = 0];
	optional uint32 adapter_id = 2 [default = 0];
	optional int32 etype = 3 [(.description) = "enum"];
	optional string mac = 4;
	optional string name = 5;
	optional bool is_connected = 6;
	optional bool is_paired = 7;
	optional bool is_pairing = 8;
	optional bool wake_allowed = 9;
	optional bool wake_allowed_supported = 10;
	optional int32 battery_percent = 11;
	optional bool operation_in_progress = 12;
	optional bool is_trusted = 13;
}

message CMsgBluetoothManagerDeviceInfo {
	optional uint32 id = 1;
	optional bool should_hide_hint = 2;
	optional int32 etype = 3 [(.description) = "enum"];
	optional bool is_connected = 4;
	optional bool is_paired = 5;
	optional int32 strength_raw = 6;
}

service BluetoothManager {
	// ePrivilege=1, eClientExecutionSite=1
	rpc CancelPair (.CBluetoothManager_CancelPair_Request) returns (.CBluetoothManager_CancelPair_Response);
	// ePrivilege=1, eClientExecutionSite=1
	rpc Connect (.CBluetoothManager_Connect_Request) returns (.CBluetoothManager_Connect_Response);
	// ePrivilege=1, eClientExecutionSite=1
	rpc Disconnect (.CBluetoothManager_Disconnect_Request) returns (.CBluetoothManager_Disconnect_Response);
	// ePrivilege=1, eClientExecutionSite=1
	rpc Forget (.CBluetoothManager_Forget_Request) returns (.CBluetoothManager_Forget_Response);
	// ePrivilege=1, eClientExecutionSite=1
	rpc GetAdapterDetails (.CBluetoothManager_GetAdapterDetails_Request) returns (.CBluetoothManager_GetAdapterDetails_Response);
	// ePrivilege=1, eClientExecutionSite=1
	rpc GetDeviceDetails (.CBluetoothManager_GetDeviceDetails_Request) returns (.CBluetoothManager_GetDeviceDetails_Response);
	// ePrivilege=1, eClientExecutionSite=1
	rpc GetState (.CBluetoothManager_GetState_Request) returns (.CBluetoothManager_GetState_Response);
	// ePrivilege=1, eClientExecutionSite=1
	rpc NotifyStateChanged (.CBluetoothManager_StateChanged_Notification) returns (.NoResponse);
	// ePrivilege=1, eClientExecutionSite=1
	rpc Pair (.CBluetoothManager_Pair_Request) returns (.CBluetoothManager_Pair_Response);
	// ePrivilege=1, eClientExecutionSite=1
	rpc SetDiscovering (.CBluetoothManager_SetDiscovering_Request) returns (.CBluetoothManager_SetDiscovering_Response);
	// ePrivilege=1, eClientExecutionSite=1
	rpc SetLoginAdvertising (.CBluetoothManager_SetLoginAdvertising_Request) returns (.CBluetoothManager_SetLoginAdvertising_Response);
	// ePrivilege=1, eClientExecutionSite=1
	rpc SetTrusted (.CBluetoothManager_SetTrusted_Request) returns (.CBluetoothManager_SetTrusted_Response);
	// ePrivilege=1, eClientExecutionSite=1
	rpc SetWakeAllowed (.CBluetoothManager_SetWakeAllowed_Request) returns (.CBluetoothManager_SetWakeAllowed_Response);
}

