Domanda

Sto scrivendo uno scanner Bluetooth che individua e identifica i dispositivi mobili nelle vicinanze locali. È qualcosa che posso realizzare usando C # o devo inserire le API C / C ++? La mia applicazione è destinata a Windows XP e Vista. I puntatori sono apprezzati.

Grazie!

È stato utile?

Soluzione

Un problema con Bluetooth sul PC è che ci sono diversi stack BT in uso e non si può mai sapere quale sia disponibile su un determinato computer. I più comuni sono Widcomm (ora Broadcom) e Microsoft (apparso in XP, forse uno dei service pack). Tuttavia, alcuni fornitori di hardware BT confezionano BlueSoleil e alcuni usano Toshiba. La maggior parte dei dongle funzionerà con lo stack MS, quindi le librerie .NET che ho visto tendono ad usarlo.

Ognuna delle pile ha un modo totalmente diverso di fare la parte di scoperta in cui cerchi dispositivi vicini e chiedi i loro servizi.

Se dovessi scegliere un approccio oggi probabilmente farei la scoperta in C ++ e aggiungere un'interfaccia per .NET.

Le cose di 32feet.net hanno funzionato abbastanza bene quando l'ho provato ma non supportavano lo stack Widcomm.

Altri suggerimenti

C'è anche 32feet.net di Peter Foot

http://inthehand.com/content/32feet.aspx

Ho giocato con questo dorso quando era v1.5 e funzionava bene.

Mike Petrichenko ha un bel framework BT. Funziona con BlueSoleil, Widcomm, Toshiba e Microsoft.

Ora si chiama Wireless Communications Library e funziona con Bluetooth 802.11 e infrarossi. Mike ha nominato la società Soft Service Company e vende licenze non commerciali e commerciali con e senza codice sorgente a prezzi compresi tra $ 100 e $ 2050.

Il modo migliore per conoscere i dispositivi Bluetooth e inviare file al dispositivo Bluetooth dal PC è usare quel codice.

    public void ExecuteCommandSync(object command)
    {
        try
        {
            // create the ProcessStartInfo using "cmd" as the program to be run,
            // and "/c " as the parameters.
            // Incidentally, /c tells cmd that we want it to execute the command that follows,
            // and then exit.
            System.Diagnostics.ProcessStartInfo procStartInfo =
                new System.Diagnostics.ProcessStartInfo("cmd", "/c " + command);

            // The following commands are needed to redirect the standard output.
            // This means that it will be redirected to the Process.StandardOutput StreamReader.
            procStartInfo.RedirectStandardOutput = true;
            procStartInfo.UseShellExecute = false;
            // Do not create the black window.
            procStartInfo.CreateNoWindow = true;

            // Now we create a process, assign its ProcessStartInfo and start it
            System.Diagnostics.Process proc = new System.Diagnostics.Process();
            proc.StartInfo = procStartInfo;
            proc.Start();

            // Get the output into a string
            string result = proc.StandardOutput.ReadToEnd();
            // Display the command output.
            Console.WriteLine(result);
        }
        catch (Exception objException)
        {
            // Log the exception
            MessageBox.Show(objException.Message);
        }
    }

Puoi chiamare questo metodo come

                          string command = "fsquirt";
                          ExecuteCommandSync(command);

Quindi, appare BluetoothFileTransferWizard ed è possibile scegliere il dispositivo disponibile e inviare il file per inviare quel dispositivo. Se non vuoi usarlo in questo modo, prova 32feet.net.uk. È stato fantastico per lo sviluppo del bluetooth per C # e VB.NET.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top