C# Class LCM.LCM.LCM

Lightweight Communications and Marshalling C#.NET implementation
Show file Open project: mlab-upenn/arch-apex Class Usage Examples

Public Methods

Method Description
Close ( ) : void

Call this function to release all resources used by the LCM instance. After calling this function, the LCM instance should consume no resources, and cannot be used to receive or transmit messages.

LCM ( ) : System

Create a new LCM object, connecting to one or more URLs. If no URL is specified, the environment variable LCM_DEFAULT_URL is used. If that environment variable is not defined, then the default URL is used.

Publish ( string channel, LCMEncodable e ) : void

Publish an LCM-defined type on a channel. If more than one URL was specified, the message will be sent on each.

Publish ( string channel, byte data, int offset, int length ) : void

Publish raw data on a channel, bypassing the LCM type specification. If more than one URL was specified when the LCM object was created, the message will be sent on each.

Publish ( string channel, string s ) : void

Publish a string on a channel. This method does not use the LCM type definitions and thus is not type safe. This method is primarily provided for testing purposes and may be removed in the future.

Subscribe ( string regex, LCMSubscriber sub ) : void

Subscribe to all channels whose name matches the regular expression. Note that to subscribe to all channels, you must specify ".*", not "*".

SubscribeAll ( LCMSubscriber sub ) : void

A convenience function that subscribes to all LCM channels.

Unsubscribe ( string regex, LCMSubscriber sub ) : void

Remove this particular regex/subscriber pair (UNTESTED AND API MAY CHANGE). If regex is null, all subscriptions for 'sub' are cancelled. If subscriber is null, any previous subscriptions matching the regular expression will be cancelled. If both 'sub' and 'regex' are null, all subscriptions will be cancelled.

Private Methods

Method Description
ReceiveMessage ( string channel, byte data, int offset, int length ) : void

Not for use by end users. Provider back ends call this method when they receive a message. The subscribers that match the channel name are synchronously notified.

Method Details

Close() public method

Call this function to release all resources used by the LCM instance. After calling this function, the LCM instance should consume no resources, and cannot be used to receive or transmit messages.
public Close ( ) : void
return void

LCM() public method

Create a new LCM object, connecting to one or more URLs. If no URL is specified, the environment variable LCM_DEFAULT_URL is used. If that environment variable is not defined, then the default URL is used.
public LCM ( ) : System
return System

Publish() public method

Publish an LCM-defined type on a channel. If more than one URL was specified, the message will be sent on each.
public Publish ( string channel, LCMEncodable e ) : void
channel string channel name
e LCMEncodable encodable object to send
return void

Publish() public method

Publish raw data on a channel, bypassing the LCM type specification. If more than one URL was specified when the LCM object was created, the message will be sent on each.
public Publish ( string channel, byte data, int offset, int length ) : void
channel string channel name
data byte data byte array
offset int offset of the data to write
length int length of the data to write
return void

Publish() public method

Publish a string on a channel. This method does not use the LCM type definitions and thus is not type safe. This method is primarily provided for testing purposes and may be removed in the future.
public Publish ( string channel, string s ) : void
channel string channel name
s string string to publich
return void

Subscribe() public method

Subscribe to all channels whose name matches the regular expression. Note that to subscribe to all channels, you must specify ".*", not "*".
public Subscribe ( string regex, LCMSubscriber sub ) : void
regex string regular expression determining the channels to subscribe
sub LCMSubscriber subscribing object providing callback
return void

SubscribeAll() public method

A convenience function that subscribes to all LCM channels.
public SubscribeAll ( LCMSubscriber sub ) : void
sub LCMSubscriber subscribing object providing callback
return void

Unsubscribe() public method

Remove this particular regex/subscriber pair (UNTESTED AND API MAY CHANGE). If regex is null, all subscriptions for 'sub' are cancelled. If subscriber is null, any previous subscriptions matching the regular expression will be cancelled. If both 'sub' and 'regex' are null, all subscriptions will be cancelled.
public Unsubscribe ( string regex, LCMSubscriber sub ) : void
regex string regular expression determining the channels to unsubscribe
sub LCMSubscriber unsubscribing object
return void