Callback functions are used in a number of cases when writing an OCSDK application. If your application is designed to process specific events, you can register a callback function that will be invoked asynchronously when the event occurs. 

In most OCSDK sample applications, the local module terminates all events that the stack generates. This hides the series of event notifications that are happening (e.g. as the mote joins). Instead, the module can post semaphores when the mote is joined and/or has a service, simplifying your code. The OCSDK provides hooks for registering callback functions for certain events:

In addition, a callback function is associated with an OSTimer and is triggered when the timer expires. 

Callback functions are not ISRs, but they have some things in common. In general, a callback function executes at higher priority than your application's tasks, so the following rules of thumb apply:

They differ from ISRs in that: