00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef _SUPPORT_BINDER_INTERFACE_H_
00014 #define _SUPPORT_BINDER_INTERFACE_H_
00015
00021 #include <support/Atom.h>
00022
00023 #if _SUPPORTS_NAMESPACE
00024 namespace palmos {
00025 namespace osp {
00026 #endif
00027 class BpBinder;
00028 #if _SUPPORTS_NAMESPACE
00029 } }
00030 #endif
00031
00032 #if _SUPPORTS_NAMESPACE
00033 namespace palmos {
00034 namespace support {
00035 #endif
00036
00048 struct BAutobinderDef;
00049 class IInterface;
00050 class BBinder;
00051 class SParcel;
00052 class SValue;
00053
00054
00055
00056
00058 enum {
00059 B_EFFECT_TRANSACTION = 'efct',
00060 B_INSPECT_TRANSACTION = 'insp',
00061 B_LINK_TRANSACTION = 'link',
00062 B_UNLINK_TRANSACTION = 'unlk',
00063 B_PING_TRANSACTION = 'ping',
00064
00065 B_PUT_TRANSACTION = '_put',
00066 B_GET_TRANSACTION = '_get',
00067 B_INVOKE_TRANSACTION = 'invk'
00068 };
00069
00071
00073 enum {
00075
00081 B_WEAK_BINDER_LINK = 0x00000001,
00082
00084
00091 B_SYNC_BINDER_LINK = 0x00000002,
00092
00094
00095 B_NO_TRANSLATE_LINK = 0x00000004,
00096
00098
00101 B_UNLINK_ALL_TARGETS = 0x00000008
00102 };
00103
00105 class IBinder : virtual public SAtom
00106 {
00107 public:
00108
00110
00118 virtual SValue Inspect(const sptr<IBinder>& caller,
00119 const SValue &which,
00120 uint32_t flags = 0) = 0;
00121
00123
00135 virtual sptr<IInterface> InterfaceFor( const SValue &descriptor,
00136 uint32_t flags = 0) = 0;
00137
00139
00149 virtual status_t Link( const sptr<IBinder>& target,
00150 const SValue &bindings,
00151 uint32_t flags = 0) = 0;
00153 virtual status_t Unlink( const wptr<IBinder>& target,
00154 const SValue &bindings,
00155 uint32_t flags = 0) = 0;
00156
00158
00160 virtual status_t Effect( const SValue &in,
00161 const SValue &inBindings,
00162 const SValue &outBindings,
00163 SValue *out) = 0;
00164
00165 virtual status_t AutobinderPut( const BAutobinderDef* def,
00166 const void* value) = 0;
00167 virtual status_t AutobinderGet( const BAutobinderDef* def,
00168 void* result) = 0;
00169 virtual status_t AutobinderInvoke( const BAutobinderDef* def,
00170 void** params,
00171 void* result) = 0;
00172
00174 status_t Put(const SValue &in);
00176 SValue Get(const SValue &bindings) const;
00178 SValue Get() const;
00180 SValue Invoke(const SValue &func, const SValue &args);
00182 SValue Invoke(const SValue &func);
00183
00185
00195 virtual status_t Transact( uint32_t code,
00196 SParcel& data,
00197 SParcel* reply = NULL,
00198 uint32_t flags = 0) = 0;
00199
00201
00221 virtual status_t LinkToDeath( const sptr<BBinder>& target,
00222 const SValue &method,
00223 uint32_t flags = 0) = 0;
00224
00226
00229 virtual status_t UnlinkToDeath( const wptr<BBinder>& target,
00230 const SValue &method,
00231 uint32_t flags = 0) = 0;
00232
00234 virtual bool IsBinderAlive() const = 0;
00235
00237
00241 virtual status_t PingBinder() = 0;
00242
00244
00251 virtual BBinder* LocalBinder();
00253
00255 virtual BNS(palmos::osp::) BpBinder* RemoteBinder();
00256
00257 protected:
00258 inline IBinder() { }
00259 inline virtual ~IBinder() { }
00260
00261 private:
00262 IBinder(const IBinder& o);
00263 };
00264
00265
00266
00269 #if _SUPPORTS_NAMESPACE
00270 } }
00271 #endif
00272
00273 #endif // _SUPPORT_BINDER_INTERFACE_H_