LCM .NET API
Classes | Public Member Functions | Properties | List of all members
LCM.LCM.LCM Class Reference

Lightweight Communications and Marshalling C#.NET implementation More...

Public Member Functions

 LCM (params string[] urls)
 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. More...
 
void Publish (string channel, string s)
 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. More...
 
void Publish (string channel, LCMEncodable e)
 Publish an LCM-defined type on a channel. If more than one URL was specified, the message will be sent on each. More...
 
void Publish (string channel, byte[] data, int offset, int length)
 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. More...
 
void Subscribe (string regex, LCMSubscriber sub)
 Subscribe to all channels whose name matches the regular expression. Note that to subscribe to all channels, you must specify ".*", not "*". More...
 
void SubscribeAll (LCMSubscriber sub)
 A convenience function that subscribes to all LCM channels. More...
 
void Unsubscribe (string regex, LCMSubscriber sub)
 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. More...
 
void Close ()
 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. More...
 

Properties

static LCM Singleton [get]
 Retrieve a default instance of LCM using either the environment variable LCM_DEFAULT_URL or the default. If an exception occurs, exit(-1) is called. More...
 
int NumSubscriptions [get]
 The number of subscriptions. More...
 

Detailed Description

Lightweight Communications and Marshalling C#.NET implementation

Constructor & Destructor Documentation

◆ LCM()

LCM.LCM.LCM.LCM ( params string[]  urls)
inline

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.

Parameters
urlsURL array

Member Function Documentation

◆ Close()

void LCM.LCM.LCM.Close ( )
inline

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.

◆ Publish() [1/3]

void LCM.LCM.LCM.Publish ( string  channel,
byte[]  data,
int  offset,
int  length 
)
inline

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.

Parameters
channelchannel name
datadata byte array
offsetoffset of the data to write
lengthlength of the data to write

◆ Publish() [2/3]

void LCM.LCM.LCM.Publish ( string  channel,
LCMEncodable  e 
)
inline

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

Parameters
channelchannel name
eencodable object to send

◆ Publish() [3/3]

void LCM.LCM.LCM.Publish ( string  channel,
string  s 
)
inline

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.

Parameters
channelchannel name
sstring to publich

◆ Subscribe()

void LCM.LCM.LCM.Subscribe ( string  regex,
LCMSubscriber  sub 
)
inline

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

Parameters
regexregular expression determining the channels to subscribe
subsubscribing object providing callback

◆ SubscribeAll()

void LCM.LCM.LCM.SubscribeAll ( LCMSubscriber  sub)
inline

A convenience function that subscribes to all LCM channels.

Parameters
subsubscribing object providing callback

◆ Unsubscribe()

void LCM.LCM.LCM.Unsubscribe ( string  regex,
LCMSubscriber  sub 
)
inline

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.

Parameters
regexregular expression determining the channels to unsubscribe
subunsubscribing object

Property Documentation

◆ NumSubscriptions

int LCM.LCM.LCM.NumSubscriptions
get

The number of subscriptions.

◆ Singleton

LCM LCM.LCM.LCM.Singleton
staticget

Retrieve a default instance of LCM using either the environment variable LCM_DEFAULT_URL or the default. If an exception occurs, exit(-1) is called.


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