Halyri - Mobiili  0.9
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events
Halyri.Connected Class Reference

Connected view is when connection to emergency exchange have been establish and processed by emergency exchange handler. If NoSound is enabled by user, this view opens up with chat. Emergency exchange can open map for user to pinpoint his location on map and send the location to emergency exchange. Handler can also open video recording. By taping cant talk enables chat also. More...

Inheritance diagram for Halyri.Connected:

Public Member Functions

 Connected ()
 Constructor that takes connection from that last view saved to phoneapplicationservice with key "connection". Then just adds all eventhandlers for it. Also starts xnadispatchtimer and ready up media transfering. More...
 
void InitializeComponent ()
 InitializeComponent More...
 
void InitializeComponent ()
 InitializeComponent More...
 
void InitializeComponent ()
 InitializeComponent More...
 
void InitializeComponent ()
 InitializeComponent More...
 

Protected Member Functions

override void OnBackKeyPress (System.ComponentModel.CancelEventArgs e)
 Adds messagebox stating that user is leaving and is he sure. User can cancel backkeypressed here. More...
 
override void OnNavigatingFrom (NavigatingCancelEventArgs e)
 Stops capturing and sending data. More...
 
override void OnNavigatedTo (NavigationEventArgs e)
 Checks up if there is nosound set in previous view so UI can add chat for user. More...
 

Private Member Functions

void connection_MeasurementStopRequestReceivedEvent (ServiceReference1.MeasurementInstrumentDto instrument)
 Handles incoming measurement stop request. Stops providing measurement data from the active MeasurementManager instance. Currently the provided instrument instance is not checked, as only one concurrent measurement can be on progress. More...
 
void connection_MeasurementStartRequestReceivedEvent (ServiceReference1.MeasurementInstrumentDto instrument)
 Handles incoming measurement start request. Starts provividing measurment data from the only data provider currently available. More...
 
void measurementManager_MeasurementDataAvailableEvent (MeasurementInstrumentDto instrument, byte[] data)
 Handles incoming measurement data provided by the active MeasurementManager instance. Publishes the data to the server through the Connection. More...
 
void connection_MeasurementInstrumentListRequestReceivedEvent ()
 Handles incoming request for a new list of avalable measurement instrument. Uploads the list provided by the MeasurementInstrumentManager. More...
 
void connection_UdpMediaDataReceivedEvent (Object sender, MediaPacket media)
 Moves media to mediaReveiverManager. More...
 
void connection_InProcessEvent ()
 Invokes ui thread that connection is now in process. More...
 
void InProcessingUiThread ()
 Adds infotext and phone icon to screen. More...
 
void MediaConfigurationUpdated (object sender, EventArgs e, MediaConfigurationDto config)
 Handles media configuration updated events generated by the active AudioVideoTransmitManager. If audio or video is enabled in the configuration and it is not currently enabled by the UI, relevant devices are enabled through ActivateCamera and ActivateAudio methods. If camera is enabled, but its state is disabled in the configuration, it is disabled by DisableCamera method. More...
 
async void ActivateCamera ()
 Initializes a AudioVideoCaptureDevice using the rear camera for video only capture. Fills the Rectangle VideoRectangle defined on the MainPage.xaml with a video brush using the initialized AudioVideoCaptureDevice as it's source. Creates a new PreviewImageCapturer that uses the AudioVideoCaptureDevice to capture raw images from the preview buffer. Registers an event listener listening for new compressed JPGs from the PreviewImageCapturer. More...
 
void DisableCamera ()
 Disables camera More...
 
void DisableAudio ()
 Disables audio More...
 
void ActivateAudio ()
 Gets the default XNA microphone in the system. More...
 
void enableXnaDispatchTimer ()
 Starts a DisptchTimer to create FrameworkDispatcher.Update calls required by the XNA framework. More...
 
void disableXnaDispatchTimer ()
 Stops the DispatchTimer FrameworkDispatcher.Update calls required by the XNA framework. More...
 
void connection_TextMessageReceivedEvent (string message)
 Invokes UI thread to update new message. More...
 
void TextMessageReceived (Connected connected, string message)
 Handles text message adding to messagebox when one is received from emergency exchange. Message contains who it is from and timestamp. More...
 
void connection_CloseMapRequestEvent ()
 Invokes UI thread to close map. More...
 
void CloseMapRequest ()
 Switchs mapgrid off. More...
 
void connection_OpenMapRequestEvent ()
 Invokes UI thread to open map. More...
 
void OpenMapRequest ()
 Turns mapgrid on. More...
 
void connection_ProcessedEvent ()
 Invokes UI thread that connection is processed. More...
 
void ConnectionProcessedUiThread ()
 At the stat if user is not in connected.xaml, returns. Shows messagebox to inform that connection is closed and then navigates back to mainpage and removes backentry so it wont come back to this view from back button. More...
 
void UpdateLocationThread ()
 Updates location and starts tracking location so it will update movement. More...
 
void SendTextMessageButton_Click (object sender, RoutedEventArgs e)
 Takes chatinput, makes textblock in chat, sends message to server and finaly clears inputbox. More...
 
void NoSoundTextBox_Tap (object sender, System.Windows.Input.GestureEventArgs e)
 Switchs checkbox value. More...
 
void NoSoundCheckBox_Checked (object sender, RoutedEventArgs e)
 Changes canMakeNoiseBool value and toggle it in server. Also adds textmessageReceived handler. So basicly mobile cannot receive messages if chat is not vissible. More...
 
void NoSoundCheckBox_Unchecked (object sender, RoutedEventArgs e)
 Changes canMakeNoiseBool value and toggle it in server. Removes textmessage received. So basicly mobile cannot receive messages if chat is not vissible. More...
 
void Map_Tap (object sender, System.Windows.Input.GestureEventArgs e)
 Gets tapped point as goordinates, adds pushpin to that location and sends the location to server. User is able to add only one pushpin, last one will be removed. More...
 
void SendLocationButton_Click (object sender, RoutedEventArgs e)
 Sends location to server as user specified if location is set from map by user. More...
 

Private Attributes

Connection connection
 
bool noSound = false
 
GeoCoordinate Coordinates
 
AudioVideoCaptureDevice audioVideoCaptureDevice
 
Microphone microphone
 
DispatcherTimer xnaLoopDispatchTimer
 
AudioVideoTransmitManager mediaTransmitManager
 
AudioVideoPlaybackManager mediaReceiveManager
 
MeasurementInstrumentManager measurementInstrumentManager
 
MeasurementManager measurementManager
 
bool videoDeviceEnabled
 
bool audioDeviceEnabled
 
bool videoDeviceBeingEnabled
 
bool audioDeviceBeingEnabled
 
ManualResetEvent CaptureDevicesInitializedEvent = new ManualResetEvent(false)
 
Settings settings = new Settings()
 
bool _contentLoaded
 

Detailed Description

Connected view is when connection to emergency exchange have been establish and processed by emergency exchange handler. If NoSound is enabled by user, this view opens up with chat. Emergency exchange can open map for user to pinpoint his location on map and send the location to emergency exchange. Handler can also open video recording. By taping cant talk enables chat also.

Constructor & Destructor Documentation

Halyri.Connected.Connected ( )

Constructor that takes connection from that last view saved to phoneapplicationservice with key "connection". Then just adds all eventhandlers for it. Also starts xnadispatchtimer and ready up media transfering.

Member Function Documentation

void Halyri.Connected.ActivateAudio ( )
private

Gets the default XNA microphone in the system.

<author>Veli-Mikko Puupponen</author>

async void Halyri.Connected.ActivateCamera ( )
private

Initializes a AudioVideoCaptureDevice using the rear camera for video only capture. Fills the Rectangle VideoRectangle defined on the MainPage.xaml with a video brush using the initialized AudioVideoCaptureDevice as it's source. Creates a new PreviewImageCapturer that uses the AudioVideoCaptureDevice to capture raw images from the preview buffer. Registers an event listener listening for new compressed JPGs from the PreviewImageCapturer.

<author>Veli-Mikko Puupponen</author>

void Halyri.Connected.CloseMapRequest ( )
private

Switchs mapgrid off.

void Halyri.Connected.connection_CloseMapRequestEvent ( )
private

Invokes UI thread to close map.

void Halyri.Connected.connection_InProcessEvent ( )
private

Invokes ui thread that connection is now in process.

void Halyri.Connected.connection_MeasurementInstrumentListRequestReceivedEvent ( )
private

Handles incoming request for a new list of avalable measurement instrument. Uploads the list provided by the MeasurementInstrumentManager.

<author>Veli-Mikko Puupponen</author>

void Halyri.Connected.connection_MeasurementStartRequestReceivedEvent ( ServiceReference1.MeasurementInstrumentDto  instrument)
private

Handles incoming measurement start request. Starts provividing measurment data from the only data provider currently available.

<author>Veli-Mikko Puupponen</author>

Parameters
instrumentInstrument
void Halyri.Connected.connection_MeasurementStopRequestReceivedEvent ( ServiceReference1.MeasurementInstrumentDto  instrument)
private

Handles incoming measurement stop request. Stops providing measurement data from the active MeasurementManager instance. Currently the provided instrument instance is not checked, as only one concurrent measurement can be on progress.

<author>Veli-Mikko Puupponen</author>

Parameters
instrumentInastrument to stop providing data from
void Halyri.Connected.connection_OpenMapRequestEvent ( )
private

Invokes UI thread to open map.

void Halyri.Connected.connection_ProcessedEvent ( )
private

Invokes UI thread that connection is processed.

void Halyri.Connected.connection_TextMessageReceivedEvent ( string  message)
private

Invokes UI thread to update new message.

Parameters
messageReceived message
void Halyri.Connected.connection_UdpMediaDataReceivedEvent ( Object  sender,
MediaPacket  media 
)
private

Moves media to mediaReveiverManager.

<author>Veli-Mikko Puupponen</author>

void Halyri.Connected.ConnectionProcessedUiThread ( )
private

At the stat if user is not in connected.xaml, returns. Shows messagebox to inform that connection is closed and then navigates back to mainpage and removes backentry so it wont come back to this view from back button.

void Halyri.Connected.DisableAudio ( )
private

Disables audio

<author>Veli-Mikko Puupponen</author>

void Halyri.Connected.DisableCamera ( )
private

Disables camera

<author>Veli-Mikko Puupponen</author>

void Halyri.Connected.disableXnaDispatchTimer ( )
private

Stops the DispatchTimer FrameworkDispatcher.Update calls required by the XNA framework.

<author>Veli-Mikko Puupponen</author>

void Halyri.Connected.enableXnaDispatchTimer ( )
private

Starts a DisptchTimer to create FrameworkDispatcher.Update calls required by the XNA framework.

<author>Veli-Mikko Puupponen</author>

void Halyri.Connected.InitializeComponent ( )

InitializeComponent

void Halyri.Connected.InitializeComponent ( )

InitializeComponent

void Halyri.Connected.InitializeComponent ( )

InitializeComponent

void Halyri.Connected.InitializeComponent ( )

InitializeComponent

void Halyri.Connected.InProcessingUiThread ( )
private

Adds infotext and phone icon to screen.

void Halyri.Connected.Map_Tap ( object  sender,
System.Windows.Input.GestureEventArgs  e 
)
private

Gets tapped point as goordinates, adds pushpin to that location and sends the location to server. User is able to add only one pushpin, last one will be removed.

void Halyri.Connected.measurementManager_MeasurementDataAvailableEvent ( MeasurementInstrumentDto  instrument,
byte[]  data 
)
private

Handles incoming measurement data provided by the active MeasurementManager instance. Publishes the data to the server through the Connection.

<author>Veli-Mikko Puupponen</author>

Parameters
instrumentInstrument providing the data
dataRaw instrument measurement data
void Halyri.Connected.MediaConfigurationUpdated ( object  sender,
EventArgs  e,
MediaConfigurationDto  config 
)
private

Handles media configuration updated events generated by the active AudioVideoTransmitManager. If audio or video is enabled in the configuration and it is not currently enabled by the UI, relevant devices are enabled through ActivateCamera and ActivateAudio methods. If camera is enabled, but its state is disabled in the configuration, it is disabled by DisableCamera method.

<author>Veli-Mikko Puupponen</author>

Parameters
senderSending object
eEventArgs, not used
configMedia configuration
void Halyri.Connected.NoSoundCheckBox_Checked ( object  sender,
RoutedEventArgs  e 
)
private

Changes canMakeNoiseBool value and toggle it in server. Also adds textmessageReceived handler. So basicly mobile cannot receive messages if chat is not vissible.

void Halyri.Connected.NoSoundCheckBox_Unchecked ( object  sender,
RoutedEventArgs  e 
)
private

Changes canMakeNoiseBool value and toggle it in server. Removes textmessage received. So basicly mobile cannot receive messages if chat is not vissible.

void Halyri.Connected.NoSoundTextBox_Tap ( object  sender,
System.Windows.Input.GestureEventArgs  e 
)
private

Switchs checkbox value.

override void Halyri.Connected.OnBackKeyPress ( System.ComponentModel.CancelEventArgs  e)
protected

Adds messagebox stating that user is leaving and is he sure. User can cancel backkeypressed here.

override void Halyri.Connected.OnNavigatedTo ( NavigationEventArgs  e)
protected

Checks up if there is nosound set in previous view so UI can add chat for user.

override void Halyri.Connected.OnNavigatingFrom ( NavigatingCancelEventArgs  e)
protected

Stops capturing and sending data.

void Halyri.Connected.OpenMapRequest ( )
private

Turns mapgrid on.

void Halyri.Connected.SendLocationButton_Click ( object  sender,
RoutedEventArgs  e 
)
private

Sends location to server as user specified if location is set from map by user.

void Halyri.Connected.SendTextMessageButton_Click ( object  sender,
RoutedEventArgs  e 
)
private

Takes chatinput, makes textblock in chat, sends message to server and finaly clears inputbox.

void Halyri.Connected.TextMessageReceived ( Connected  connected,
string  message 
)
private

Handles text message adding to messagebox when one is received from emergency exchange. Message contains who it is from and timestamp.

Parameters
messageReceived message
void Halyri.Connected.UpdateLocationThread ( )
private

Updates location and starts tracking location so it will update movement.

Member Data Documentation

bool Halyri.Connected._contentLoaded
private
bool Halyri.Connected.audioDeviceBeingEnabled
private
bool Halyri.Connected.audioDeviceEnabled
private
AudioVideoCaptureDevice Halyri.Connected.audioVideoCaptureDevice
private
ManualResetEvent Halyri.Connected.CaptureDevicesInitializedEvent = new ManualResetEvent(false)
private
Connection Halyri.Connected.connection
private
GeoCoordinate Halyri.Connected.Coordinates
private
MeasurementInstrumentManager Halyri.Connected.measurementInstrumentManager
private
MeasurementManager Halyri.Connected.measurementManager
private
AudioVideoPlaybackManager Halyri.Connected.mediaReceiveManager
private
AudioVideoTransmitManager Halyri.Connected.mediaTransmitManager
private
Microphone Halyri.Connected.microphone
private
bool Halyri.Connected.noSound = false
private
Settings Halyri.Connected.settings = new Settings()
private
bool Halyri.Connected.videoDeviceBeingEnabled
private
bool Halyri.Connected.videoDeviceEnabled
private
DispatcherTimer Halyri.Connected.xnaLoopDispatchTimer
private

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