picofuse-objc

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

Sends a message to a target when a stream has something to read, or room to write, as an event source of the application. More...

#import <Application/Application.h>

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

Instance Methods

(NXStream *) - stream
 Returns the stream.
 
(BOOL) - isAttached
 Returns YES if it's attached, so its messages are sent.
 
- 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

(NXStreamSource *) + sourceWithStream:target:readable:writable:
 Returns a source for a stream, which isn't attached. 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 when a stream has something to read, or room to write, as an event source of the application.

target:self
readable:@selector(readable:)
writable:NULL];
- (void)readable:(NXStream *)stream {
NXString *text = [stream readStringWithLength:128];
}

It's a stream device of picofuse's HID while it's attached, and the messages are sent on any of the run loop's workers, with the stream as their argument. A stream is writable again after a write which didn't all fit, once there's room: on a Pico's UART, but never on a host's serial device, whose writes wait until they're taken.

Only streams which say when they can be read or written can be attached: a NXSerialPort, and the standard input and output when they're a Pico's UART or a host's terminal, but not RTT or USB. The stream is retained, and has to stay open while it's attached. A stream can only be attached by one source at a time, which includes the standard input or output of another NXStream.

Definition at line 40 of file NXStreamSource.h.

Method Documentation

◆ sourceWithStream:target:readable:writable:()

+ (NXStreamSource *) sourceWithStream: (NXStream *)  stream
target: (id)  target
readable: (SEL)  readable
writable: (SEL)  writable 

Returns a source for a stream, which isn't attached.

Parameters
streamThe stream, which is retained.
targetWhat the messages are sent to, which is retained.
readableA method of the target which has the stream as its one argument, sent when there's something to read, or NULL.
writableA method of the target which has the stream as its one argument, sent when there's room to write again, or NULL.
Returns
The source, or nil if the stream or target is nil, both selectors are NULL, or one isn't a method of the target which takes one object.

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