]>
Commit | Line | Data |
---|---|---|
3cbfba02 DW |
1 | /*++\r |
2 | \r | |
3 | Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r | |
4 | \r\r | |
9dc8036d MK |
5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
6 | \r | |
3cbfba02 DW |
7 | \r\r |
8 | \r | |
9 | Module Name:\r | |
10 | \r | |
11 | Observable.h\r | |
12 | \r | |
13 | Abstract:\r | |
14 | \r | |
15 | Prototypes for Observable protocol implementation\r | |
16 | --*/\r | |
17 | \r | |
18 | #ifndef _OBSERVABLE_H_\r | |
19 | #define _OBSERVABLE_H_\r | |
20 | #include "PlatformDxe.h"\r | |
21 | #include "Protocol/Observable.h"\r | |
22 | \r | |
23 | //\r | |
24 | // Prototypes\r | |
25 | //\r | |
26 | \r | |
27 | /** Install observable protocol.\r | |
28 | *\r | |
29 | * Install interface and initialize the observable protocol.\r | |
30 | *\r | |
31 | * @param VOID No parameters.\r | |
32 | *\r | |
33 | * @return EFI_SUCCESS Successfully installed and initialized the protocol.\r | |
34 | **/\r | |
35 | EFI_STATUS\r | |
36 | InitializeObservableProtocol(\r | |
37 | VOID\r | |
38 | );\r | |
39 | \r | |
40 | /** Remove all observables.\r | |
41 | *\r | |
42 | * Remove all observable guids and all interfaces subscribed to them.\r | |
43 | *\r | |
44 | * @param VOID No parameters.\r | |
45 | *\r | |
46 | * @return EFI_SUCCESS Successfully removed all observables and subscribed interfaces.\r | |
47 | **/\r | |
48 | EFI_STATUS\r | |
49 | EFIAPI\r | |
50 | RemoveAllObservables(\r | |
51 | VOID\r | |
52 | );\r | |
53 | \r | |
54 | /** Subscribe an interface with an observable guid.\r | |
55 | *\r | |
56 | * Use this to register a callback function with a guid. The function provided by CallbackInterface will be executed\r | |
57 | * whenever the appropriate observable instance specified by ReferenceGuid calls Publish.\r | |
58 | *\r | |
59 | * @param EFI_GUID ReferenceGuid The observable guid that the callback interface will subscribe to.\r | |
60 | * OBS_CALLBACK CallbackInterface A pointer to the function that is subscribing to the observable.\r | |
61 | *\r | |
62 | * @return EFI_SUCCESS Successfully subscribed the interface to the observable guid.\r | |
63 | * EFI_NOT_FOUND No match could be found between the provided guid and existing observables.\r | |
64 | * EFI_OUT_OF_RESOURCES Could not subscribe to this observer due to resource limitations.\r | |
65 | * EFI_INVALID_PARAMETER Interface is already subscribed to this observer.\r | |
66 | **/\r | |
67 | EFI_STATUS\r | |
68 | EFIAPI\r | |
69 | Subscribe (\r | |
70 | IN EFI_GUID ReferenceGuid,\r | |
71 | IN OBS_CALLBACK CallbackInterface\r | |
72 | );\r | |
73 | \r | |
74 | /** Unsubscribe an interface with an observable guid.\r | |
75 | *\r | |
76 | * Use this to remove an interface from the callback list associated with an observable guid.\r | |
77 | *\r | |
78 | * @param EFI_GUID ReferenceGuid The observable guid to unsubscribe the interface from.\r | |
79 | * OBS_CALLBACK CallbackInterface A pointer to the interface that is being unsubscribed.\r | |
80 | *\r | |
81 | * @return EFI_SUCCESS Successfully unsubscribed the interface from the observable guid.\r | |
82 | **/\r | |
83 | EFI_STATUS\r | |
84 | EFIAPI\r | |
85 | Unsubscribe (\r | |
86 | IN EFI_GUID ReferenceGuid,\r | |
87 | IN OBS_CALLBACK CallbackInterface\r | |
88 | );\r | |
89 | \r | |
90 | /** Notify observing functions.\r | |
91 | *\r | |
92 | * Use this to notify all functions who are subscribed to the guid specified by ReferenceGuid.\r | |
93 | *\r | |
94 | * @param EFI_GUID ReferenceGuid The observable guid that contains the list of interfaces to be notified.\r | |
95 | * VOID* Data Parameter context to be passed to the subscribed function.\r | |
96 | *\r | |
97 | * @return EFI_SUCCESS Successfully notified all observers listening to this guid.\r | |
98 | * EFI_NOT_FOUND No match could be found between the provided guid and existing observables.\r | |
99 | **/\r | |
100 | EFI_STATUS\r | |
101 | EFIAPI\r | |
102 | Publish (\r | |
103 | IN EFI_GUID ReferenceGuid,\r | |
104 | IN OUT VOID* Data\r | |
105 | );\r | |
106 | \r | |
107 | /** Creates a new observable.\r | |
108 | *\r | |
109 | * Create a new observable that can be observed with the use of Subscribe function.\r | |
110 | *\r | |
111 | * @param EFI_GUID ReferenceGuid The observable guid to add.\r | |
112 | *\r | |
113 | * @return EFI_SUCCESS Successfully added observable.\r | |
114 | * EFI_INVALID_PARAMETER Observable already exists.\r | |
115 | **/\r | |
116 | EFI_STATUS\r | |
117 | EFIAPI\r | |
118 | AddObservable (\r | |
119 | IN EFI_GUID ReferenceGuid\r | |
120 | );\r | |
121 | \r | |
122 | /** Remove an observable.\r | |
123 | *\r | |
124 | * Remove an observable so that it can no longer be subscribed to. In addition, unsubscribe any functions\r | |
125 | * that are subscribed to this guid.\r | |
126 | *\r | |
127 | * @param EFI_GUID ReferenceGuid The observable guid to remove.\r | |
128 | *\r | |
129 | * @return EFI_SUCCESS Successfully removed observable.\r | |
130 | **/\r | |
131 | EFI_STATUS\r | |
132 | EFIAPI\r | |
133 | RemoveObservable (\r | |
134 | IN EFI_GUID ReferenceGuid\r | |
135 | );\r | |
136 | \r | |
137 | #endif\r |