public ScannerAudio() { _writeToFile = false; _listDataBuffer_Audio = new ReadWriteBuffer (65535); _streamingPlayer = new StreamingPlaybackV2 (); _streamingPlayer.Start (); }
/// <summary> /// Send login message to a PSM server /// </summary> /// <description> /// You can login to a PSM server in two ways: /// 1. Anonymous : You will only hear the scanner sound playback and see the scanner screen. /// 2. Admin : You will have full control over the scanner /// </description> /// <param name="m">Message</param> /// <seealso cref="ProScanMobile.Encryption"/> public void Login(string m) { _loginDone.Reset (); _httpResponse = string.Empty; Send (m); _sendDone.WaitOne (); if (_sendStatus == SendStatus.Ok) { Receive (ReceiveType.Http); _receiveDone.WaitOne (); if (_httpResponse == CONST_HTTP_OK) { _connectionBuffer = new ReadWriteBuffer (65535); _bytesReceived = 0; Receive (ReceiveType.Data); _receiveDone.WaitOne (); string[] message = bytesTostring(_connectionBuffer.Read (_connectionBuffer.Count, true)).Split(' '); if (message [2] == "PS20") { _loginStatus = LoginStatus.Error; _loginStatusMessage = "Connection refused."; } else { _loginStatus = LoginStatus.LoggedIn; _loginStatusMessage = "Logged in."; } } else { _loginStatus = LoginStatus.Error; _loginStatusMessage = "Connection refused."; } } else { _loginStatus = LoginStatus.Error; _loginStatusMessage = "Connection refused."; } _loginDone.Set (); }
/// <summary> /// Close this instance. /// </summary> /// <description> /// Close the connection to the PSM server /// </description> public void Close() { _closeDone.Reset (); if (_tcpSocket != null) { _tcpSocket.Close (); _connectionStatus = ConnectionStatus.Disconnected; _connectionStatusMessage = "Closed."; _loginStatus = LoginStatus.LoggedOut; _loginStatusMessage = "Logged out."; _connectionBuffer = null; _tcpSocket = null; } _closeDone.Set (); }
public void Dispose() { if (_writeToFile) StopOutputToFile (); _listDataBuffer_Audio = null; _streamingPlayer.Dispose (); _streamingPlayer = null; }