1// Copyright 2017 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. 4 5// Next MinVersion: 3 6 7// This file defines the mojo interface between Android, Chrome and the 8// Chrome OS daemon for the MIDI implementation used in ARC. 9 10module arc.mojom; 11 12// This struct is used to send information to the client regarding a device 13// which has been (dis)connected, and which the client can use to request 14// subdevice ports from the daemon. 15struct MidisDeviceInfo { 16 uint32 card; 17 uint32 device_num; 18 uint32 num_subdevices; 19 uint32 flags; 20 string name; 21 string manufacturer; 22}; 23 24// This struct is used by the client to both request a subdevice port FD, as 25// well as to close all its connections to a particular device. In the latter 26// case, the |subdevice_num| field is left unused. 27struct MidisRequest { 28 uint32 card; 29 uint32 device_num; 30 uint32 subdevice_num; 31}; 32 33// This interface is used by the server to send device and other information 34// to the client. It should be implemented by the client, and a handle to it 35// should be passed to the server. 36// Next Method ID: 2 37interface MidisClient { 38 OnDeviceAdded@0(MidisDeviceInfo device); 39 OnDeviceRemoved@1(MidisDeviceInfo device); 40}; 41 42// This interface is used by the client to send messages / requests to the 43// daemon. This should be implemented by midis. 44// Next Method ID: 4 45interface MidisServer { 46 // Used to list out the MIDI devices that are currently connected to the 47 // midis daemon. 48 ListDevices@0() => (array<MidisDeviceInfo> devices); 49 50 // This function returns a handle(a Unix FD wrapped in a Mojo Handle) 51 // for a subdevice specified by |request|. 52 // In the event of an error, returns an empty handle. 53 // DEPRECATED: Please use RequestPort@3 instead. 54 RequestPortDeprecated@1(MidisRequest request) => (handle port_handle); 55 [MinVersion=2] 56 RequestPort@3(MidisRequest request) => (handle? port_handle); 57 58 // This function closes all open FDs the client may have on the specified 59 // device, and removes the client from the device's data structure. 60 CloseDevice@2(MidisRequest request); 61}; 62 63// This interface is needed to get the midis server interface handle. 64// It is also used to send a handle to the midis client interface (this is 65// used to send messages to the client, and the interface is implemented 66// by the client). 67// Next Method ID: 1 68interface MidisHost { 69 Connect@0( 70 pending_receiver<MidisServer> server, pending_remote<MidisClient> client); 71}; 72 73// MidisInstance is implemented in the ARC MIDI JNI code that 74// runs in Android and handles the Android side of the ArcBridge connection. 75// Next Method ID: 2 76interface MidisInstance { 77 // DEPRECATED: Please use Init@1 instead. 78 InitDeprecated@0(pending_remote<MidisHost> host_remote); 79 80 // Establishes full-duplex communication with the host. 81 [MinVersion=1] Init@1(pending_remote<MidisHost> host_remote) => (); 82}; 83