picofuse-objc

Instance Methods | Class Methods | List of all members
NXTimer Class Reference

Sends a message to a target after an interval, once or repeatedly, on the application's run loop. More...

#import <Application/Application.h>

Inheritance diagram for NXTimer:
Inheritance graph
[legend]
Collaboration diagram for NXTimer:
Collaboration graph
[legend]

Instance Methods

(BOOL) - schedule
 Schedules it, by attaching it to the shared application: it starts when the application runs, or straight away if it's running. More...
 
(void) - invalidate
 Stops it, and detaches it from the application. More...
 
(void) - fire
 Sends the message now, on the calling thread, whether or not it's scheduled, as long as it's valid.
 
(NXDuration) - interval
 Returns the interval.
 
(BOOL) - repeats
 Returns YES if it repeats.
 
(BOOL) - isValid
 Returns YES until it's been invalidated, or has fired once if it doesn't repeat.
 
- Instance Methods inherited from NXObject
(void) - dealloc
 Frees the instance. More...
 
(NXZone *) - zone
 Returns the zone in which the instance was allocated. More...
 
(id) - retain
 Increases the retain count of the receiver. More...
 
(void) - release
 Decreases the retain count of the receiver. More...
 
(id) - autorelease
 Releases the receiver later, when the current autorelease pool of the thread is drained. More...
 
(id) - copy
 Returns a copy which can't be changed by anything else, which the caller owns and has to release. More...
 
(uintptr_t) - hash
 Returns a number for the object, which is the same for objects which are equal by isEqual:. More...
 
(NXString *) - description
 Returns a string which describes the instance, for logging. More...
 
- Instance Methods inherited from Object
(id) - init
 Initialize the instance, after allocation. More...
 
(Class) - class
 Returns the class of the instance. More...
 
(Class) - superclass
 Returns the superclass of the instance. More...
 
(BOOL) - isEqual:
 Compares the receiver to another object for equality. More...
 
(BOOL) - isKindOfClass:
 Returns a Boolean value that indicates whether the receiver is an instance of a given class. More...
 
(BOOL) - conformsTo:
 Checks if the receiver's class conforms to a protocol. More...
 
- Instance Methods inherited from <ObjectProtocol>
(BOOL) - respondsToSelector:
 Checks if the receiver responds to a selector. More...
 

Class Methods

(NXTimer *) + timerWithInterval:repeats:target:selector:
 Returns a new timer, which isn't scheduled. More...
 
- Class Methods inherited from NXObject
(id) + alloc
 Allocates a new instance in the default zone, or if there isn't one, with sys_calloc(). More...
 
(id) + allocWithZone:
 Allocates a new instance in a specific zone. More...
 
(id) + new
 Allocates and initializes a new instance, as [[cls alloc] init] does. More...
 
(NXString *) + description
 Returns the name of the class.
 
- Class Methods inherited from Object
(void) + initialize
 Performs one-time initialization for the class. More...
 
(Class) + class
 Returns the class object. More...
 
(Class) + superclass
 Returns the superclass of the class. More...
 
(const char *) + name
 Returns the name of the class. More...
 
(BOOL) + conformsTo:
 Checks if the class conforms to a protocol. More...
 

Additional Inherited Members

- Protected Attributes inherited from Object
Class isa
 A pointer to the object's class structure. More...
 

Detailed Description

Sends a message to a target after an interval, once or repeatedly, on the application's run loop.

It's a timer of picofuse's HID, which there's a limited number of. Once scheduled, it stays attached to the application, and retained by it, until it's invalidated, or has fired once if it doesn't repeat. If there's no HID timer left when it starts, it's invalidated. The message is sent on any of the run loop's workers, so if the run loop is busy, firings of a repeating timer can be sent at the same time on different workers.

Definition at line 23 of file NXTimer.h.

Method Documentation

◆ invalidate()

- (void) invalidate

Stops it, and detaches it from the application.

It doesn't fire after this, and can't be scheduled again.

◆ schedule()

- (BOOL) schedule

Schedules it, by attaching it to the shared application: it starts when the application runs, or straight away if it's running.

Returns
YES, or NO if it's been invalidated, or there's no HID timer left.

◆ timerWithInterval:repeats:target:selector:()

+ (NXTimer *) timerWithInterval: (NXDuration)  interval
repeats: (BOOL)  repeats
target: (id)  target
selector: (SEL)  selector 

Returns a new timer, which isn't scheduled.

Parameters
intervalHow long before it fires, and between firings, rounded up to a millisecond.
repeatsYES to fire until it's invalidated, or NO to fire once.
targetWhat the message is sent to, which is retained.
selectorA method of the target which has the timer as its one argument, such as -tick:(NXTimer *)timer.
Returns
The timer, or nil if the interval isn't more than zero, the target doesn't have the method, or there isn't enough memory.

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