Sedona

sys::Service


sys::Obj
  sys::Virtual
    sys::Component
      sys::Service

public abstract class Service [niagaraIcon="module://icons/x16/gears.png"]

Service is a component which gets to execute background work between execution cycles. Services are also designed to be looked up by type within an application.


nextService

public Service nextService

Used for App's linked list of services

canHibernate

public virtual bool canHibernate()

Return true if this Service will allow hibernation. Default is to return true, subclass must override if it has a need to prevent hibernation.

onHibernate

public virtual void onHibernate()

Callback when device is entering low-power sleep mode.

onUnhibernate

public virtual void onUnhibernate()

Callback when device is exiting low-power sleep mode.

work

public virtual bool work()

Perform a chunk of background work. Return true if there is pending work or false if the service is done working this cycle. A service should be designed to function correctly no matter how many times work is called per execution cycle. Returning false is not a guarantee that work will not be called again in a given execution cycle; rather, it is a hint to the App execution engine that this service does not have any more work to do. If you only want to do work once per execution cycle, you should consider: 1) Moving your work into the execute() callback. execute() will only be called once per execution cycle. 2) Set a "newCycle" flag in your execute() method and unset it after doing one work cycle. Only do your work if the newCycle flag is set.