Developer

API Reference

IValueModel_AddListener()

Brew Release
Brew MP 1.0.2
Description
This function allows objects such as widgets and UI controls to attach a listener to the given value model. The listener includes a callback function that BREW will call whenever the model has changed state, thereby notifying the owner of the listener that data has changed. To illustrate, consider a widget that displays the current charge of battery. The widget itself is responsible for displaying battery charge, while the value of the charge would be managed by a value model that receives updates from the device as battery strength changes. The battery widget would register as a listener for the battery model by calling IVALUEMODEL_AddListener(). As the model learns of changes to the battery charge, the value model would send out notifications to any registered object -- in this case, to the battery widget, which could then redraw itself to accurately portray battery strength.
Parameters
  • pif
    []:
    Pointer to the IValueModel interface object.
  • pl
    []:
    Pointer to the ModelListener that will be attached to the object. The ModelListener will contain the PFNLISTENER callback function BREW will call to notify the registering object of changes to the value model.
Interface
Prototype
   int IValueModel_AddListener(IValueModel *pif, ModelListener pl); 
Return
   AEE_SUCCESS      - Listener successfully added
   AEE_EBADPARM     - Invalid argument
   ENOMEMORY        - Insufficient memory
Side Effect
None
Comment
None
  • Follow