Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 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 #ifndef MEDIA_MIDI_USB_MIDI_DEVICE_H_ | |
| 6 #define MEDIA_MIDI_USB_MIDI_DEVICE_H_ | |
| 7 | |
| 8 #include <vector> | |
| 9 | |
| 10 #include "base/basictypes.h" | |
| 11 #include "base/callback.h" | |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "media/base/media_export.h" | |
| 14 | |
| 15 namespace media { | |
| 16 | |
| 17 class MEDIA_EXPORT UsbMidiDeviceDelegate { | |
| 18 public: | |
| 19 virtual ~UsbMidiDeviceDelegate() {} | |
| 20 virtual void ReceiveUsbMidiData(int endpoint_number, | |
| 21 const uint8* data, | |
| 22 size_t size, | |
| 23 double timestamp) = 0; | |
| 24 }; | |
| 25 | |
| 26 class MEDIA_EXPORT UsbMidiDevice { | |
| 27 public: | |
| 28 typedef std::vector<scoped_ptr<UsbMidiDevice> > Devices; | |
| 29 class Factory { | |
| 30 public: | |
| 31 typedef base::Callback<void(bool result, Devices* devices)> Callback; | |
| 32 virtual ~Factory() {} | |
| 33 // Enumerates devices. | |
| 34 // Devices that have no USB-MIDI interfaces can be omitted. | |
| 35 // When the operation succeeds, |callback| will be called with |true| and | |
| 36 // devices. | |
| 37 // Otherwise |callback| will be called with |false| and empty devices. | |
| 38 // When this factory is destroyed during the operation, the operation | |
| 39 // will be canceled silently (i.e. |callback| will not be called). | |
| 40 virtual void EnumerateDevices(Callback callback) = 0; | |
| 41 }; | |
| 42 | |
| 43 virtual ~UsbMidiDevice() {} | |
| 44 | |
| 45 // Returns the descriptor of this device. | |
| 46 virtual std::vector<uint8> GetDescriptor() = 0; | |
| 47 | |
| 48 // Sends |data| to the given USB endpoint of this device. | |
| 49 virtual void Send(uint8 endpoint_number, const std::vector<uint8>& data) = 0; | |
|
Takashi Toyoshima
2013/12/24 04:19:32
uint8 and int are used for endpoint_number. Any re
yhirano
2013/12/24 05:57:01
I would use uint8 in UsbMidiJack and UsbMidiDescri
| |
| 50 }; | |
| 51 | |
| 52 } // namespace media | |
| 53 | |
| 54 #endif // MEDIA_MIDI_USB_MIDI_DEVICE_H_ | |
| OLD | NEW |