IBinder Class Reference
[Binder]

#include <support/IBinder.h>

Inheritance diagram for IBinder:

SAtom BBinder BpBinder BnCatalog BnCatalogPermissions BnCommand BnDatum BnInformant BnInformed BnInstallHandler BnInterface BnInterface< IByteInput > BnInterface< IByteOutput > BnInterface< IByteSeekable > BnInterface< IMemory > BnInterface< IMemoryDealer > BnInterface< IMemoryHeap > BnInterface< IStorage > BnInterface< IXMLOStr > BnIterable BnIterator BnNib BnNode BnNodeObserver BnProcess BnProcessManager BnProgress BnRandomIterator BnReferable BnSelector BnTable BnTerminalView BnUuid BnVirtualMachine BObserver List of all members.

Detailed Description

Abstract generic (scripting) interface to a Binder object.


Public Member Functions

virtual status_t AutobinderGet (const BAutobinderDef *def, void *result)=0
virtual status_t AutobinderInvoke (const BAutobinderDef *def, void **params, void *result)=0
virtual status_t AutobinderPut (const BAutobinderDef *def, const void *value)=0
virtual BNS (palmos::osp::) BpBinder *RemoteBinder()
 Internal function to retrieve remote proxy object.
virtual status_t Effect (const SValue &in, const SValue &inBindings, const SValue &outBindings, SValue *out)=0
 Perform an action on the binder.
SValue Get () const
 Synonym for Effect(SValue::undefined, SValue::undefined, SValue::wild, [result]).
SValue Get (const SValue &bindings) const
 Synonym for Effect(SValue::undefined, SValue::undefined, bindings, [result]).
virtual SValue Inspect (const sptr< IBinder > &caller, const SValue &which, uint32_t flags=0)=0
 Probe binder for interface information.
virtual sptr< IInterfaceInterfaceFor (const SValue &descriptor, uint32_t flags=0)=0
 Retrieve direct interface for this binder.
SValue Invoke (const SValue &func)
 Synonym for Effect(SValue(func,SValue::wild), SValue::wild, func, [result]).
SValue Invoke (const SValue &func, const SValue &args)
 Synonym for Effect(SValue(func,args), SValue::wild, func, [result]).
virtual bool IsBinderAlive () const =0
 Return true if this binder still existed as of the last executed operation.
virtual status_t Link (const sptr< IBinder > &target, const SValue &bindings, uint32_t flags=0)=0
 Link registers the IBinder "target" for notification of events.
virtual status_t LinkToDeath (const sptr< BBinder > &target, const SValue &method, uint32_t flags=0)=0
 Register the IBinder "target" for a notification if this binder goes away.
virtual BBinderLocalBinder ()
 Use this function instead of a dynamic_cast<> to up-cast to a BBinder.
virtual status_t PingBinder ()=0
 Send a ping to the remote binder, and return status.
status_t Put (const SValue &in)
 Synonym for Effect(in, SValue::wild, SValue::undefined, NULL).
virtual status_t Transact (uint32_t code, SParcel &data, SParcel *reply=NULL, uint32_t flags=0)=0
 Low-level data transfer.
virtual status_t Unlink (const wptr< IBinder > &target, const SValue &bindings, uint32_t flags=0)=0
 Remove a mapping previously added by Link().
virtual status_t UnlinkToDeath (const wptr< BBinder > &target, const SValue &method, uint32_t flags=0)=0
 Remove a previously registered death notification.

Protected Member Functions

 IBinder ()
virtual ~IBinder ()


Constructor & Destructor Documentation

IBinder  )  [inline, protected]
 

virtual ~IBinder  )  [inline, protected, virtual]
 


Member Function Documentation

virtual status_t AutobinderGet const BAutobinderDef def,
void *  result
[pure virtual]
 

Implemented in BBinder, and BpBinder.

virtual status_t AutobinderInvoke const BAutobinderDef def,
void **  params,
void *  result
[pure virtual]
 

Implemented in BBinder, and BpBinder.

virtual status_t AutobinderPut const BAutobinderDef def,
const void *  value
[pure virtual]
 

Implemented in BBinder, and BpBinder.

virtual BNS palmos::osp::   )  [virtual]
 

Internal function to retrieve remote proxy object.

This is for internal use by the system. Use LocalBinder() to determine if this IBinder is a local object.

virtual status_t Effect const SValue in,
const SValue inBindings,
const SValue outBindings,
SValue out
[pure virtual]
 

Perform an action on the binder.

Either a get, put, or invocation, depending on the supplied and requested bindings.

Implemented in BBinder, BnByteInput, BnByteOutput, BnByteSeekable, and BpBinder.

SValue Get  )  const
 

Synonym for Effect(SValue::undefined, SValue::undefined, SValue::wild, [result]).

SValue Get const SValue bindings  )  const
 

Synonym for Effect(SValue::undefined, SValue::undefined, bindings, [result]).

virtual SValue Inspect const sptr< IBinder > &  caller,
const SValue which,
uint32_t  flags = 0
[pure virtual]
 

Probe binder for interface information.

Return interfaces implemented by this binder object that are requested by which. This is a composition of all interfaces, expressed as { descriptor -> binder } mappings, which are selected through which.

Much more information on Inspect() can be found at Binder Inspect() Details.

Implemented in BnCommand, BnProgress, BnTerminalView, BnInstallHandler, BnInformant, BnInformed, BnReferable, BnCatalog, BnCatalogPermissions, BnDatum, BnIterable, BnIterator, BnNib, BnNode, BnNodeObserver, BnProcess, BnProcessManager, BnRandomIterator, BnSelector, BnTable, BnUuid, BnVirtualMachine, BSchemaDatabaseNode, BSchemaRowIDJoin, BSchemaRowIDJoin::RowNode, BSchemaRowIDJoin::JoinIterator, BSchemaTableNode, BSchemaTableNode::RowNode, BSchemaTableNode::QueryIterator, BCatalogDelegate, BCatalogDelegate::IteratorDelegate, BGenericIterable::GenericIterator, BIndexedDataNode, BIndexedIterable::IndexedIterator, BIndexedTableNode, BStreamDatum::Stream, BBinder, BnInterface, BByteStream, BReadOnlyStream, BWriteOnlyStream, BGenericCatalog, BIndexedCatalog, BCatalogMirror, BIOSStream, BMemoryStore, BNullStream, BPipe, BTokenSource, BpBinder, BnInterface< IStorage >, BnInterface< IMemoryDealer >, BnInterface< IXMLOStr >, BnInterface< IMemory >, BnInterface< IByteOutput >, BnInterface< IByteInput >, BnInterface< IMemoryHeap >, and BnInterface< IByteSeekable >.

virtual sptr<IInterface> InterfaceFor const SValue descriptor,
uint32_t  flags = 0
[pure virtual]
 

Retrieve direct interface for this binder.

Given a SValue interface descriptor, return an IInterface implementing it. The default implementation of this function returns NULL, meaning it does not implement a direct interface to it. If the return is non-NULL, you are guaranteed to be able to static_cast<> the returned interface into the requested subclass and have it work.

Note that this is NOT the same as calling Inspect(), which performs conversion between different IBinder objects. This method converts to an IInterface only for this binder object.

Implemented in BnCommand, BnProgress, BnTerminalView, BnInstallHandler, BnInformant, BnInformed, BnReferable, BnCatalog, BnCatalogPermissions, BnDatum, BnIterable, BnIterator, BnNib, BnNode, BnNodeObserver, BnProcess, BnProcessManager, BnRandomIterator, BnSelector, BnTable, BnUuid, BnVirtualMachine, BBinder, BnInterface, BpBinder, BnInterface< IStorage >, BnInterface< IMemoryDealer >, BnInterface< IXMLOStr >, BnInterface< IMemory >, BnInterface< IByteOutput >, BnInterface< IByteInput >, BnInterface< IMemoryHeap >, and BnInterface< IByteSeekable >.

SValue Invoke const SValue func  ) 
 

Synonym for Effect(SValue(func,SValue::wild), SValue::wild, func, [result]).

SValue Invoke const SValue func,
const SValue args
 

Synonym for Effect(SValue(func,args), SValue::wild, func, [result]).

virtual bool IsBinderAlive  )  const [pure virtual]
 

Return true if this binder still existed as of the last executed operation.

Implemented in BBinder, and BpBinder.

virtual status_t Link const sptr< IBinder > &  target,
const SValue bindings,
uint32_t  flags = 0
[pure virtual]
 

Link registers the IBinder "target" for notification of events.

The bindings is a mapping of keys that will get pushed on this IBinder, to keys that will get pushed on the "target" IBinder. e.g.

  • If you call link thus: binder1->Link(binder2, SValue("A", "B"));
  • When "A" is pushed on binder1: binder1->Push(SValue("A", "C"));
  • The following will get called on binder2: binder2->Effect(SValue("B", "C"), SValue::wild, SValue::undefined, NULL);

Implemented in BNodeDelegate, BBinder, BnByteInput, BnByteOutput, BnByteSeekable, BCatalogMirror, and BpBinder.

virtual status_t LinkToDeath const sptr< BBinder > &  target,
const SValue method,
uint32_t  flags = 0
[pure virtual]
 

Register the IBinder "target" for a notification if this binder goes away.

The method is the name of a method to call if this binder unexpectedly goes away. This is accomplished by performing an Effect() on target with the given method. Prior to doing so, a mapping { 0 -> this } is added to the method name, so that the first parameter of the function is the dying binder. I.e., your method should look like:

SomethingDied(const wptr<IBinder>& who)

Note:
You will only receive death notifications for remote binders, as local binders by definition can't die without you dying as well.

This link always holds a weak reference to its target.

You will only receive a weak reference to the dead binder. You should not try to promote this to a strong reference. (Nor should you need to, as there is nothing useful you can directly do with it now that it has passed on.)

Implemented in BBinder, and BpBinder.

BBinder * LocalBinder  )  [virtual]
 

Use this function instead of a dynamic_cast<> to up-cast to a BBinder.

Since multiple BBinder instances can appear in a single object, a regular dynamic_cast<> is ambiguous. Note that there is a default implementation of this (which returns NULL) so that we can call the method even if the object has been destroyed. (That is, if we only have a weak reference on it.)

Reimplemented in BBinder, and BpBinder.

virtual status_t PingBinder  )  [pure virtual]
 

Send a ping to the remote binder, and return status.

If this is a local binder, ping always returns B_OK. If this is a remote binder, it performs a Transact() to the local binder and returns that status. This should be either B_OK or B_BINDER_DEAD.

Implemented in BBinder, and BpBinder.

status_t Put const SValue in  ) 
 

Synonym for Effect(in, SValue::wild, SValue::undefined, NULL).

virtual status_t Transact uint32_t  code,
SParcel data,
SParcel reply = NULL,
uint32_t  flags = 0
[pure virtual]
 

Low-level data transfer.

This is the Binder's IPC primitive. It allows you to send a parcel of data to another Binder (possibly in another process or language) and get a parcel of data back. The parcel can contain IBinder objects to transfer references between environments. The code can be any arbitrary value, though some standard codes are defined for parts of the higher-level IBinder protocol (B_EFFECT_TRANSACTION, B_INSPECT_TRANSACTION, etc). The flags are used for internal IPC implementation and must always be set to 0 when calling. If your implementation of Transact() returns an error code (instead of B_OK), that code will be propagated back to the caller WITHOUT any reply data.

Implemented in BnCommand, BnProgress, BnTerminalView, BnInstallHandler, BnInformant, BnInformed, BnReferable, BnCatalog, BnCatalogPermissions, BnDatum, BnIterable, BnIterator, BnNib, BnNode, BnNodeObserver, BnProcess, BnProcessManager, BnRandomIterator, BnSelector, BnTable, BnUuid, BnVirtualMachine, BBinder, BnByteInput, BnByteOutput, BnByteSeekable, BnMemoryHeap, BnMemory, BnMemoryDealer, BnStorage, and BpBinder.

virtual status_t Unlink const wptr< IBinder > &  target,
const SValue bindings,
uint32_t  flags = 0
[pure virtual]
 

Remove a mapping previously added by Link().

Implemented in BNodeDelegate, BBinder, BnByteInput, BnByteOutput, BnByteSeekable, BCatalogMirror, and BpBinder.

virtual status_t UnlinkToDeath const wptr< BBinder > &  target,
const SValue method,
uint32_t  flags = 0
[pure virtual]
 

Remove a previously registered death notification.

The target and method must exactly match the values passed in to LinkToDeath().

Implemented in BBinder, and BpBinder.


The documentation for this class was generated from the following files: