示例#1
0
 /// <summary>
 /// Register the Opp Server with the Opp service.
 /// </summary>
 /// <remarks>
 /// The device must be bonded with remote device by CreateBond().
 /// If connection request is received from OPP Client, ConnectionRequested event will be invoked.
 /// </remarks>
 /// <returns>The BluetoothOppServer instance.</returns>
 /// <param name="FilePath"> Path to store the files.</param>
 /// <feature>http://tizen.org/feature/network.bluetooth.opp</feature>
 /// <exception cref="NotSupportedException">Thrown when the required feature is not Supported.</exception>
 /// <exception cref="NotSupportedException">Thrown when the BT/BTLE is not Supported.</exception>
 /// <exception cref="InvalidOperationException">Thrown when the BT/BTLE is not Enabled or Other Bluetooth Errors.</exception>
 /// <since_tizen> 4 </since_tizen>
 public static BluetoothOppServer StartServer(string FilePath)
 {
     if (BluetoothAdapter.IsBluetoothEnabled && Globals.IsInitialize)
     {
         if (_instance == null)
         {
             BluetoothOppServer server = new BluetoothOppServer();
             if (server != null)
             {
                 _instance = server;
             }
         }
         int ret = _impl.StartServer(FilePath);
         if (ret != (int)BluetoothError.None)
         {
             Log.Error(Globals.LogTag, "Failed to Opp Start Server - " + (BluetoothError)ret);
             BluetoothErrorFactory.ThrowBluetoothException(ret);
         }
         return(_instance);
     }
     else
     {
         BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled);
     }
     return(null);
 }