Halyri - Häke  0.9.1
 All Classes Namespaces Functions Variables Enumerations Properties
Connection Class Reference

Handles communication between server and this client. User must use connect method to connect server. After that user can use rest of the methods to manage connection. Also user should handle most of events, but atleast connectionupdatedevent. More...

Public Member Functions

delegate void AssigmentUpdated (ObservableCollection< Assignment > newConnections)
 Invoked when connection is updated. More...
 
delegate void AssignmentTakenForHandling ()
 Invoked when currentconnection is setted. More...
 
 Connection (String username, String password)
 Creates connection with credentials provided. More...
 
ObservableCollection< AssignmentConnect (String endpointAddress)
 Creates receiver and connects to server with wcf and udp. More...
 
bool UdpSendMedia (MediaInformation mediaInfo, byte[] data, int originalLength)
 Sends media to the server using the active UdpMediaClientSocket instance. Returns true, is the data is successfully queued for sending, otherwise returns false. More...
 
void ChangePriority (Assignment assignment, Assignment.priorities priority)
 Chances priority to currentconnetion and then updates that to connectionslist and finaly to server. It makes the connection in new thread so it won't block ui thread. More...
 
ObservableCollection< AssignmentConvertConnectionsToAssigments (ConnectionDto[] Connections)
 Converts ConnectionDto to Assignment. If location is not set, uses null and do not assign accuracymeters or time from location. If device info is empty, uses empty DeviceInfoDto. More...
 
void RequestAction (RemoteActionDto action)
 Requests action for current userconnection for currentconnection with given action. CurrentConnection needed or this does nothing. More...
 
void RequestMeasurementData (MeasurementInstrumentDto instrument)
 If there is currentconnection requests measurements data start from server with given instrument. More...
 
void CancelMeasurementData (MeasurementInstrumentDto instrument)
 Cancel request to server to stop measurement data sending. Current connection is needed for this. More...
 
bool IsConnected ()
 Is Connection on. More...
 
ObservableCollection< AssignmentGetAllConnections ()
 Should be used only one time to save localy and then use ActiveConnectionsUpdated to update those. Userconnection and converts server response to assignment list. More...
 
bool Reconnect ()
 Reconnects to server. More...
 
bool Disconnect ()
 Disconnects from server. More...
 
void ProcessAssignment (object assignment)
 Changes assignments state to in progress to server. First it search right connection using guid and then makes the connection currentconnection. More...
 
void SendTextMessage (String message)
 Makes new thread to send message to server so it won't block ui thread. More...
 
void RequestAudioVideoMedia ()
 Makes new thread to request audio video so it won't block ui thread. More...
 
void RequestAudioMedia ()
 
void CancelAudioVideoMedia ()
 Makes new thread to request cancel of audio and video so it won't block ui thread. More...
 
async Task PingAsync (int interval)
 Sends a keepalive message to server More...
 

Public Attributes

UdpMediaDataReceived UdpMediaDataReceivedEvent
 

Properties

AsyncReceiver receiver [get, set]
 Gets and sets AsyncReceiver. More...
 

Events

AssigmentUpdated AssigmentUpdatedEvent
 
AssignmentTakenForHandling AssignmentTakenForHandlingEvent
 

Detailed Description

Handles communication between server and this client. User must use connect method to connect server. After that user can use rest of the methods to manage connection. Also user should handle most of events, but atleast connectionupdatedevent.

<author>Atte Söderlund</author>

Constructor & Destructor Documentation

Connection ( String  username,
String  password 
)

Creates connection with credentials provided.

Parameters
usernameUsername that connection uses
passwordPassword that connection uses

Member Function Documentation

delegate void AssigmentUpdated ( ObservableCollection< Assignment newConnections)

Invoked when connection is updated.

Parameters
newConnectionsConnections as Assignments
delegate void AssignmentTakenForHandling ( )

Invoked when currentconnection is setted.

void CancelAudioVideoMedia ( )

Makes new thread to request cancel of audio and video so it won't block ui thread.

void CancelMeasurementData ( MeasurementInstrumentDto  instrument)

Cancel request to server to stop measurement data sending. Current connection is needed for this.

<author>Niko Mononen</author>

Parameters
instrumentInstrument that is sending the data
void ChangePriority ( Assignment  assignment,
Assignment.priorities  priority 
)

Chances priority to currentconnetion and then updates that to connectionslist and finaly to server. It makes the connection in new thread so it won't block ui thread.

Parameters
assignmentAssignment that needs updating
priorityPriority that assignment is to bee changed.
ObservableCollection<Assignment> Connect ( String  endpointAddress)

Creates receiver and connects to server with wcf and udp.

Returns
ObservableCollection of connections as assignments.
ObservableCollection<Assignment> ConvertConnectionsToAssigments ( ConnectionDto[]  Connections)

Converts ConnectionDto to Assignment. If location is not set, uses null and do not assign accuracymeters or time from location. If device info is empty, uses empty DeviceInfoDto.

Parameters
ConnectionConnectionDto that needs converting to Assigment
Returns
Converted Assigment
bool Disconnect ( )

Disconnects from server.

Returns
True when disconnect goes without error and false if there is any error.
ObservableCollection<Assignment> GetAllConnections ( )

Should be used only one time to save localy and then use ActiveConnectionsUpdated to update those. Userconnection and converts server response to assignment list.

Returns
ObservableCollection of all connections as Assignment
bool IsConnected ( )

Is Connection on.

Returns
Boolean of is connection established.
async Task PingAsync ( int  interval)

Sends a keepalive message to server

<author>Ilkka Rautiainen</author>

Parameters
intervalping interval in seconds
Returns
task
void ProcessAssignment ( object  assignment)

Changes assignments state to in progress to server. First it search right connection using guid and then makes the connection currentconnection.

Parameters
assignmentAssignment that is to be set as in progress
bool Reconnect ( )

Reconnects to server.

Returns
True when reconnect goes without error and false if there is any error.
void RequestAction ( RemoteActionDto  action)

Requests action for current userconnection for currentconnection with given action. CurrentConnection needed or this does nothing.

Parameters
actionWhat user wants action to be
void RequestAudioVideoMedia ( )

Makes new thread to request audio video so it won't block ui thread.

void RequestMeasurementData ( MeasurementInstrumentDto  instrument)

If there is currentconnection requests measurements data start from server with given instrument.

<author>Niko Mononen</author>

Parameters
instrumentInstrument that provides data
void SendTextMessage ( String  message)

Makes new thread to send message to server so it won't block ui thread.

Parameters
messageMessage to be send
bool UdpSendMedia ( MediaInformation  mediaInfo,
byte[]  data,
int  originalLength 
)

Sends media to the server using the active UdpMediaClientSocket instance. Returns true, is the data is successfully queued for sending, otherwise returns false.

Parameters
mediaInfoDescription of the media
dataBytes constituting the media data
originalLengthLength of the media prior to encoding for such encodings that require the length for decompression.
Returns
True, if data queued for sending, otherwise false

Property Documentation

AsyncReceiver receiver
getset

Gets and sets AsyncReceiver.


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