00001
00002
00003
00004
00005 #ifndef SERVICES_IINFORMANT_H
00006 #define SERVICES_IINFORMANT_H
00007
00008 #include <support/IInterface.h>
00009 #include <support/Binder.h>
00010 #include <support/Context.h>
00011 #include <support/String.h>
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include <support/IProcess.h>
00025 #include <support/INode.h>
00026
00027
00028
00029 #if _SUPPORTS_NAMESPACE
00030 namespace palmos {
00031 namespace services {
00032 using namespace palmos::support;
00033 #endif
00034
00036
00072 class IInformant : public IInterface
00073 {
00074 public:
00075 B_DECLARE_META_INTERFACE(Informant)
00076
00077
00078
00079
00080
00081
00095 virtual status_t RegisterForCallback(const SValue& key, const sptr<IBinder>& target, const SValue& method, uint32_t flags = 0, const SValue& cookie = B_UNDEFINED_VALUE) = 0;
00096
00098
00121
00122 virtual status_t RegisterForCreation(const SValue& key, const sptr<INode>& context, const sptr<IProcess>& process, const SString& component, const SValue& inspect, const SValue& method, uint32_t flags = 0, const SValue& cookie = B_UNDEFINED_VALUE) = 0;
00123
00125
00134 virtual status_t UnregisterForCallback(const SValue& key, const sptr<IBinder>& target, const SValue& method, uint32_t flags = 0) = 0;
00135
00137
00150 virtual status_t UnregisterForCreation(const SValue& key, const sptr<INode>& context, const sptr<IProcess>& process, const SString& component, const SValue& inspect, const SValue& method, uint32_t flags = 0) = 0;
00151
00153
00161 virtual status_t Inform(const SValue& key, const SValue& information) = 0;
00162
00163
00164 status_t LinkInformant(const sptr<IBinder>& to, const SValue& mappings, uint32_t flags = 0)
00165 {
00166 return AsBinder()->Link(to, mappings, flags);
00167 }
00168 status_t UnlinkInformant(const sptr<IBinder>& to, const SValue& mappings, uint32_t flags = 0)
00169 {
00170 return AsBinder()->Unlink(to, mappings, flags);
00171 }
00172
00173 protected:
00174 IInformant() { }
00175 virtual ~IInformant();
00176
00177 private:
00178
00179 IInformant(const IInformant& o);
00180 IInformant& operator=(const IInformant& o);
00181 };
00182
00184
00198 class IInformed : public IInterface
00199 {
00200 public:
00201 B_DECLARE_META_INTERFACE(Informed)
00202
00203
00204
00205
00206
00207
00215 virtual void OnInform(const SValue& information, const SValue& cookie, const SValue& key) = 0;
00216
00217
00218 status_t LinkInformed(const sptr<IBinder>& to, const SValue& mappings, uint32_t flags = 0)
00219 {
00220 return AsBinder()->Link(to, mappings, flags);
00221 }
00222 status_t UnlinkInformed(const sptr<IBinder>& to, const SValue& mappings, uint32_t flags = 0)
00223 {
00224 return AsBinder()->Unlink(to, mappings, flags);
00225 }
00226
00227 protected:
00228 IInformed() { }
00229 virtual ~IInformed();
00230
00231 private:
00232
00233 IInformed(const IInformed& o);
00234 IInformed& operator=(const IInformed& o);
00235 };
00236
00237
00238
00239
00240 class BnInformant : public IInformant, public BBinder
00241 {
00242 public:
00243 virtual SValue Inspect(const sptr<IBinder>& caller, const SValue& which, uint32_t flags = 0);
00244 virtual sptr<IInterface> InterfaceFor(const SValue& descriptor, uint32_t flags = 0);
00245
00246 protected:
00247 BnInformant();
00248 BnInformant(const SContext& context);
00249 virtual ~BnInformant();
00250
00251 virtual sptr<IBinder> AsBinderImpl();
00252 virtual sptr<const IBinder> AsBinderImpl() const;
00253
00254
00255 virtual status_t HandleEffect(const SValue &, const SValue &, const SValue &, SValue *);
00256 virtual status_t Transact(uint32_t code, SParcel& data, SParcel* reply, uint32_t flags);
00257
00258 private:
00259 BnInformant(const BnInformant& o);
00260 BnInformant& operator=(const BnInformant& o);
00261 };
00262
00263
00264 class BnInformed : public IInformed, public BBinder
00265 {
00266 public:
00267 virtual SValue Inspect(const sptr<IBinder>& caller, const SValue& which, uint32_t flags = 0);
00268 virtual sptr<IInterface> InterfaceFor(const SValue& descriptor, uint32_t flags = 0);
00269
00270 protected:
00271 BnInformed();
00272 BnInformed(const SContext& context);
00273 virtual ~BnInformed();
00274
00275 virtual sptr<IBinder> AsBinderImpl();
00276 virtual sptr<const IBinder> AsBinderImpl() const;
00277
00278
00279 virtual status_t HandleEffect(const SValue &, const SValue &, const SValue &, SValue *);
00280 virtual status_t Transact(uint32_t code, SParcel& data, SParcel* reply, uint32_t flags);
00281
00282 private:
00283 BnInformed(const BnInformed& o);
00284 BnInformed& operator=(const BnInformed& o);
00285 };
00286
00287
00288 #if _SUPPORTS_NAMESPACE
00289 } }
00290 #endif
00291
00292
00293
00294
00295 #endif // SERVICES_IINFORMANT_H
00296