PDA

View Full Version : کار با bluetooth



bia2download
سه شنبه 22 دی 1388, 19:01 عصر
می خوام بدونم که راهی وجود داره که با برنامه نویسی از طریق bluetooth سیستم یک فایل ارسال یا دریافت کرد

Netsky
سه شنبه 22 دی 1388, 21:16 عصر
سلام دوست عزیز .
من توی MSDN مایکروسافت سرچ کردم . اینو بدست آوردم : لینک (http://msdn.microsoft.com/en-us/library/aa362932(VS.85).aspx)
البته به زبون C++ هستش .
گفتم این لینک رو بذارم شاید خودت تونستی کد معادل سی شارپش رو بنویسی .
البته اگه توی Code Project (http://www.codeproject.com/info/search.aspx?artkw=bluttooth+in+C%23) یه سرچ بزنی ممکنه چیزای خوبی دستگیرت بشه .

FastCode
سه شنبه 22 دی 1388, 22:40 عصر
من قبلا" میخواستم این کار رو بکنم.
تا اینجا پیش رفتم:

class Bluetooth
{
[DllImport("irprops.cpl", SetLastError = true)]
public static extern uint BluetoothAuthenticateDevice(IntPtr hwndParent, IntPtr hRadio, ref BluetoothDeviceInfo pbtdi, long pszPasskey, ulong ulPasskeyLength);
[DllImport("irprops.cpl", EntryPoint = "BluetoothEnableDiscovery", SetLastError = true)]
[return: MarshalAsAttribute(UnmanagedType.Bool)]
public static extern bool BluetoothEnableDiscovery(IntPtr hRadio, [MarshalAsAttribute(UnmanagedType.Bool)] bool fEnabled);
[DllImport("irprops.cpl", SetLastError = true)]
public static extern bool BluetoothEnableIncomingConnections(IntPtr hRadio, bool fEnabled);
[DllImport("irprops.cpl", SetLastError = true)]
private static extern uint BluetoothEnumerateInstalledServices(IntPtr hRadio, ref BluetoothDeviceInfo pbtdi, ref uint pcServices, Guid[] pGuidServices);
[DllImport("irprops.cpl", SetLastError = true)]
public static extern bool BluetoothFindDeviceClose(IntPtr hFind);
public struct BluetoothDeviceInfo
{
public uint dwSize;
public ulong Address;
public uint ulClassofDevice;
public bool fConnected;
public bool fRemembered;
public bool fAuthenticated;
public SYSTEMTIME stLastSeen;
public SYSTEMTIME stLastUsed;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 248)]
public string szName;
public void Initialize() { this.dwSize = (uint)Marshal.SizeOf(typeof(BluetoothDeviceInfo)); }
}
[StructLayout(LayoutKind.Sequential)]
public struct SYSTEMTIME
{
[MarshalAs(UnmanagedType.U2)]
public short Year;
[MarshalAs(UnmanagedType.U2)]
public short Month;
[MarshalAs(UnmanagedType.U2)]
public short DayOfWeek;
[MarshalAs(UnmanagedType.U2)]
public short Day;
[MarshalAs(UnmanagedType.U2)]
public short Hour;
[MarshalAs(UnmanagedType.U2)]
public short Minute;
[MarshalAs(UnmanagedType.U2)]
public short Second;
[MarshalAs(UnmanagedType.U2)]
public short Milliseconds;

public SYSTEMTIME(DateTime dt)
{
Year = (short)dt.Year;
Month = (short)dt.Month;
DayOfWeek = (short)dt.DayOfWeek;
Day = (short)dt.Day;
Hour = (short)dt.Hour;
Minute = (short)dt.Minute;
Second = (short)dt.Second;
Milliseconds = (short)dt.Millisecond;
}
}
[StructLayout(LayoutKind.Sequential)]
private struct BluetoothDeviceSeachParams
{
internal UInt32 dwSize;
internal bool fReturnAuthenticated;
internal bool fReturnRemembered;
internal bool fReturnUnknown;
internal bool fReturnConnected;
internal bool fIssueInquiry;
internal byte cTimeoutMultiplier;
internal IntPtr hRadio;

internal void Initialize() { this.dwSize = (uint)Marshal.SizeOf(typeof(BluetoothDeviceSeachPa rams)); }
}
}

اگر چیز دیگه پیدا کردید لطفا" upload کنید.

system32
چهارشنبه 23 دی 1388, 00:03 صبح
به لینک زیر مراجعه کنید:

http://barnamenevis.org/forum/showthread.php?t=191671

Sajjad.Aghapour
چهارشنبه 23 دی 1388, 00:33 صبح
در مورد obex bluetooth جستجو کنید، مطالب، سورس کد و کامپوننت هایی زیادی در این زمینه ارائه شده....

http://www.codeproject.com/KB/mobile/ObeXplorer.aspx

...
موفق باشید/
...