MuvslideConnection

Version: 1.0.0.0

class MuvslideConnection

class ForestIndieGames.Muvslide.MuvslideConnection

An instance of this class is the entry point for using Muvslide from the client side.

Create an instance of this class to start and stop the connection with the Muvslide App. It is important to stop the connection when your application is closed in order to free up the network resources, otherwise the client application could freeze.

This class contains methods to send feedback messages to the Muvslide App such as a vibration signal or to change the image displayed in the gesture area.

Every MuvslideConnection instance contains an instance of MuvslideAppConfig that you can use to set and retrieve configuration from the Muvslide App.

Every MuvslideConnection instance also contains an instance of MuvslideInput from where you can read the smarpthone's input captured by the Muvslide App.

Implement the IMuvslideObserver interface in order to subscribe to the notifications sent by a MuvslideConnection instance.

You cannot inherit from this class.


Constructors

MuvslideConnection

ForestIndieGames.Muvslide.MuvslideConnection (IMuvslideObserver firstObserver)

Creates a new instance of the MuvslideConnection class with a first observer to be notified about new input received from the Muvslide App. Additional observers can be added by using the AddObserver method.

Parameters

Parameter Description
IMuvslideObserver firstObserver Object to be notified about new input received from the Muvslide App.

 

MuvslideConnection

ForestIndieGames.Muvslide.MuvslideConnection ()

Creates a new instance of the MuvslideConnection class. You can add observers later by using the AddObserver method.

 


Methods

GetInputManager

ForestIndieGames.Muvslide.MuvslideInput GetInputManager ()

Returns the MuvslideInput object that stores the smartphone's input received from the Muvslide App.

Returns The instance of MuvslideInput attached to this MuvslideConnection.

 

GetAppConfiguration

ForestIndieGames.Muvslide.MuvslideAppConfig GetAppConfiguration ()

Returns a MuvslideAppConfig object that you can use to set and retrieve configuration from the Muvslide App.

Returns The instance of MuvslideAppConfig attached to this MuvslideConnection.

 

AddObserver

void AddObserver (IMuvslideObserver observer)

Adds an observer object to be notified about new input received from the Muvslide App. The observers must implement IMuvslideObserver interface.

Parameters

Parameter Description
IMuvslideObserver observer IMuvslideObserver object to be notified about new input received from the Muvslide App.

 

RemoveObserver

void RemoveObserver (IMuvslideObserver observer)

Removes an observer object already registered to get notifications about new input received from the Muvslide App.

If the observer received is not registered this method does nothing.

Parameters

Parameter Description
IMuvslideObserver observer IMuvslideObserver object to be removed from the list of observers.

 

ContainsObserver

bool ContainsObserver (IMuvslideObserver observer)

Use this method to know if a given IMuvslideObserver object is already registered as an observer of this MuvslideConnection instance.

Returns 'true' if the object is already registered as an observer, otherwise it returns 'false'.

Parameters

Parameter Description
IMuvslideObserver observer The IMuvslideObserver object to evaluate.

 

StartConnection

void StartConnection ()

Starts the connection with a Muvslide App running in a smartphone connected to the same local network the client running this method is connected.

The Muvslide App is found by sending a broadcast message through the local network. Some networks block broadcast messages for security reasons; blocking the connection setup process. For now the only workaround to this is to create a separate local network if you don't have control over the blocked network.

This method closes any previous connections before starting the connection setup process, which makes this method incompatible with the WaitForConnectionFromBroadcast method.

The completion of this method does not guarantee the connection setup process has completed; instead use the MuvslideInput object, or the IMuvslideObserver notifications, to know when input is received from the Muvslide App.

IMuvslideObserver observers get notified about the status of the connection setup process.

 

WaitForConnectionFromBroadcast

void WaitForConnectionFromBroadcast ()

Open a network port for listening for broadcasted messages from a Muvslide App asking to start the connection.

The Muvslide App requesting to start the connection must be running in a smartphone connected to the same local network the client running this method is connected.

Some networks block broadcast messages for security reasons; blocking the connection setup process. For now the only workaround to this is to create a separate local network.

This method closes any previous connections before starting the connection setup process, which makes this method incompatible with the StartConnection method.

 

StopWaitingBroadcast

void StopWaitingBroadcast ()

Closes the network port previously opened using WaitForConnectionFromBroadcast method. If the network port was not open this method does nothing.

 

SendFeedbackMessage

void SendFeedbackMessage (SimpleFeedbackMessage message)

Sends a feedback message to the Muvslide App, e.g. a short vibration to help the user to understand something happened in the client application.

The message is sent as not important. Not important messages have a very small chance of not arriving to the smartphone, but favor performance.

Parameters

Parameter Description
SimpleFeedbackMessage message Feedback message to be sent.

 

SendFeedbackMessage

void SendFeedbackMessage (SimpleFeedbackMessage message, bool important)

Sends a feedback message to the Muvslide App, e.g. a short vibration to help the user to understand something happened in the client application.

The message can be sent as important or not important. Important messages block the communication until the client receives a confirmation message from the Muvslide App. Not important messages have a very small chance of not arriving to the smartphone, but favor performance.

Parameters

Parameter Description
SimpleFeedbackMessage message Feedback message to be sent.
bool important Use 'true' to send the message as important.

 

ResetAppGestureAreaIcon

void ResetAppGestureAreaIcon ()

Resets the image of the Muvslide App gesture area to the default image.

 

SetAppGestureAreaIcon

void SetAppGestureAreaIcon (string imageIdentifier)

Changes the image displayed in Muvslide App gesture area for an image previously stored using method StoreCustomizedIconOnConnect in the MuvslideAppConfig instance.

You can obtain the MuvslideAppConfig instance by calling GetAppConfiguration method.

Parameters

Parameter Description
string imageIdentifier The same image identifier previously used to store the image.

 

Close

void Close ()

Closes the connection, frees up the network resources, and stops the background threads used in the connection.

It is important to stop the connection when your application is closed in order to free up the network resources, otherwise the client application could freeze.

 


Properties and Fields

IsWaitingForBroadcast

bool IsWaitingForBroadcast

Returns True if the network port that reads broadcast messages to start the connection is listening to the network.