OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #ifndef WebMIDIAccessorClient_h | 31 #ifndef WebMIDIAccessorClient_h |
32 #define WebMIDIAccessorClient_h | 32 #define WebMIDIAccessorClient_h |
33 | 33 |
34 #include "WebString.h" | 34 #include "WebString.h" |
35 | 35 |
36 namespace blink { | 36 namespace blink { |
37 | 37 |
38 class WebMIDIAccessorClient { | 38 class WebMIDIAccessorClient { |
39 public: | 39 public: |
| 40 enum MIDIPortState { |
| 41 MIDIPortStateDisconnected, |
| 42 MIDIPortStateConnected, |
| 43 MIDIPortStateOpened, |
| 44 }; |
| 45 |
40 // didAddInputPort() and didAddOutputPort() can be called before and after | 46 // didAddInputPort() and didAddOutputPort() can be called before and after |
41 // didStartSession() is called. But |id| should be unique in each function. | 47 // didStartSession() is called. But |id| should be unique in each function. |
| 48 // FIXME: Remove obsolete interfaces that use isActive. |
42 virtual void didAddInputPort(const WebString& id, const WebString& manufactu
rer, const WebString& name, const WebString& version, bool isActive) = 0; | 49 virtual void didAddInputPort(const WebString& id, const WebString& manufactu
rer, const WebString& name, const WebString& version, bool isActive) = 0; |
43 virtual void didAddOutputPort(const WebString& id, const WebString& manufact
urer, const WebString& name, const WebString& version, bool isActive) = 0; | 50 virtual void didAddOutputPort(const WebString& id, const WebString& manufact
urer, const WebString& name, const WebString& version, bool isActive) = 0; |
| 51 virtual void didAddInputPort(const WebString& id, const WebString& manufactu
rer, const WebString& name, const WebString& version, MIDIPortState) = 0; |
| 52 virtual void didAddOutputPort(const WebString& id, const WebString& manufact
urer, const WebString& name, const WebString& version, MIDIPortState) = 0; |
44 // didSetInputPortState() and didSetOutputPortState() should not be called | 53 // didSetInputPortState() and didSetOutputPortState() should not be called |
45 // until didStartSession() is called. | 54 // until didStartSession() is called. |
| 55 // FIXME: Remove obsolete interfaces that use isActive. |
46 virtual void didSetInputPortState(unsigned portIndex, bool isActive) = 0; | 56 virtual void didSetInputPortState(unsigned portIndex, bool isActive) = 0; |
47 virtual void didSetOutputPortState(unsigned portIndex, bool isActive) = 0; | 57 virtual void didSetOutputPortState(unsigned portIndex, bool isActive) = 0; |
| 58 virtual void didSetInputPortState(unsigned portIndex, MIDIPortState) = 0; |
| 59 virtual void didSetOutputPortState(unsigned portIndex, MIDIPortState) = 0; |
48 | 60 |
49 virtual void didStartSession(bool success, const WebString& error, const Web
String& message) = 0; | 61 virtual void didStartSession(bool success, const WebString& error, const Web
String& message) = 0; |
50 | 62 |
51 // |timeStamp| is in milliseconds according to the Web MIDI API. | 63 // |timeStamp| is in milliseconds according to the Web MIDI API. |
52 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat
a, size_t length, double timeStamp) = 0; | 64 virtual void didReceiveMIDIData(unsigned portIndex, const unsigned char* dat
a, size_t length, double timeStamp) = 0; |
53 | 65 |
54 protected: | 66 protected: |
55 virtual ~WebMIDIAccessorClient() { } | 67 virtual ~WebMIDIAccessorClient() { } |
56 }; | 68 }; |
57 | 69 |
58 } // namespace blink | 70 } // namespace blink |
59 | 71 |
60 #endif // WebMIDIAccessorClient_h | 72 #endif // WebMIDIAccessorClient_h |
OLD | NEW |