OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_MIDI_USB_MIDI_DEVICE_H_ | 5 #ifndef MEDIA_MIDI_USB_MIDI_DEVICE_H_ |
6 #define MEDIA_MIDI_USB_MIDI_DEVICE_H_ | 6 #define MEDIA_MIDI_USB_MIDI_DEVICE_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "media/base/media_export.h" | 14 #include "media/midi/usb_midi_export.h" |
15 | 15 |
16 namespace media { | 16 namespace media { |
17 | 17 |
18 class MidiManagerUsb; | 18 class MidiManagerUsb; |
19 class UsbMidiDevice; | 19 class UsbMidiDevice; |
20 | 20 |
21 // Delegate class for UsbMidiDevice. | 21 // Delegate class for UsbMidiDevice. |
22 // Each method is called when an corresponding event arrives at the device. | 22 // Each method is called when an corresponding event arrives at the device. |
23 class MEDIA_EXPORT UsbMidiDeviceDelegate { | 23 class USB_MIDI_EXPORT UsbMidiDeviceDelegate { |
24 public: | 24 public: |
25 virtual ~UsbMidiDeviceDelegate() {} | 25 virtual ~UsbMidiDeviceDelegate() {} |
26 | 26 |
27 // Called when USB-MIDI data arrives at |device|. | 27 // Called when USB-MIDI data arrives at |device|. |
28 virtual void ReceiveUsbMidiData(UsbMidiDevice* device, | 28 virtual void ReceiveUsbMidiData(UsbMidiDevice* device, |
29 int endpoint_number, | 29 int endpoint_number, |
30 const uint8* data, | 30 const uint8* data, |
31 size_t size, | 31 size_t size, |
32 base::TimeTicks time) = 0; | 32 base::TimeTicks time) = 0; |
33 | 33 |
34 // Called when a USB-MIDI device is attached. | 34 // Called when a USB-MIDI device is attached. |
35 virtual void OnDeviceAttached(scoped_ptr<UsbMidiDevice> device) = 0; | 35 virtual void OnDeviceAttached(scoped_ptr<UsbMidiDevice> device) = 0; |
36 // Called when a USB-MIDI device is detached. | 36 // Called when a USB-MIDI device is detached. |
37 virtual void OnDeviceDetached(size_t index) = 0; | 37 virtual void OnDeviceDetached(size_t index) = 0; |
38 }; | 38 }; |
39 | 39 |
40 // UsbMidiDevice represents a USB-MIDI device. | 40 // UsbMidiDevice represents a USB-MIDI device. |
41 // This is an interface class and each platform-dependent implementation class | 41 // This is an interface class and each platform-dependent implementation class |
42 // will be a derived class. | 42 // will be a derived class. |
43 class MEDIA_EXPORT UsbMidiDevice { | 43 class USB_MIDI_EXPORT UsbMidiDevice { |
44 public: | 44 public: |
45 typedef ScopedVector<UsbMidiDevice> Devices; | 45 typedef ScopedVector<UsbMidiDevice> Devices; |
46 | 46 |
47 // Factory class for USB-MIDI devices. | 47 // Factory class for USB-MIDI devices. |
48 // Each concrete implementation will find and create devices | 48 // Each concrete implementation will find and create devices |
49 // in platform-dependent way. | 49 // in platform-dependent way. |
50 class Factory { | 50 class Factory { |
51 public: | 51 public: |
52 typedef base::Callback<void(bool result, Devices* devices)> Callback; | 52 typedef base::Callback<void(bool result, Devices* devices)> Callback; |
53 virtual ~Factory() {} | 53 virtual ~Factory() {} |
(...skipping 24 matching lines...) Expand all Loading... |
78 // Return the device version. | 78 // Return the device version. |
79 virtual std::string GetDeviceVersion() = 0; | 79 virtual std::string GetDeviceVersion() = 0; |
80 | 80 |
81 // Sends |data| to the given USB endpoint of this device. | 81 // Sends |data| to the given USB endpoint of this device. |
82 virtual void Send(int endpoint_number, const std::vector<uint8>& data) = 0; | 82 virtual void Send(int endpoint_number, const std::vector<uint8>& data) = 0; |
83 }; | 83 }; |
84 | 84 |
85 } // namespace media | 85 } // namespace media |
86 | 86 |
87 #endif // MEDIA_MIDI_USB_MIDI_DEVICE_H_ | 87 #endif // MEDIA_MIDI_USB_MIDI_DEVICE_H_ |
OLD | NEW |