关于Windows Mobile和PC数据传输的问题

Mr.Chronos 2008-04-29 03:42:21
各位大侠,目前我想实现的一个功能就是PC端和Windows Mobile的数据传输。也就是往phone里写数据和从phone中读数据。比如我读到短信,联系人的数据后,把它传到PC段,在PC短修改,新增联系人信息后传到手机上。
已经研究过的方案包括:1. 建立Socket连接来收发数据,这个在USB方式下能够成功实现,但是蓝牙的话就跟具体的协议栈有关,我用的IVT的蓝牙驱动
的话就没办法创建socket,后来查了下,原来是在XP with SP2 下不支持ISSC的蓝牙芯片。也弄过蓝牙的虚拟串口通信
的方式,但感觉太复杂。遂放弃了。
2. 利用RAPI,自定义RAPI函数来实现数据收发,但是封装的自定义函数DLL必须要经过签名才能使用,而且要在手机上安装一个
SdkCerts.CAB。但是这个SdkCerts要在特权模式下才能安装,所以这样一来,这个就成为调用自定义Rapi函数的最大障碍了。
经过多日的苦心研究,遂决定来此征询各位大侠的意见。是我在哪些地方还有疏忽,还是可以采用另外的什么方式来实现数据的传输呢?请大家给我一点意见或者相关的资料吧。

谢谢各位~!


...全文
425 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
ylgiii 2009-06-22
  • 打赏
  • 举报
回复
目前想到的通讯方式:
1:usb
2:蓝牙,PC段虚拟串口转蓝牙
3:GPRS(产生费用,肯定不OK)
4:WIFI(需要AP设备)
所以还是usb+ActiveSync比较靠谱
knowledge_Is_Life 2008-05-01
  • 打赏
  • 举报
回复
我也想知道,正在找這方面的資料~~~~~
meiZiNick 2008-05-01
  • 打赏
  • 举报
回复
这个简单啊,网上搜一下就得到答案了.
UltraBejing 2008-05-01
  • 打赏
  • 举报
回复
接分是王道!
Mr.Chronos 2008-04-30
  • 打赏
  • 举报
回复
嗯,可否讲的再具体一点呢?谢谢
tober 2008-04-30
  • 打赏
  • 举报
回复
下面是连接GPRS的类,直接可用

using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Collections;
using System.Threading;
using System.Windows.Forms;

namespace Callback
{
/// <summary>
/// gprs连接类
/// </summary>
public class GPRSConnection
{
const int S_OK = 0;
const uint CONNMGR_PARAM_GUIDDESTNET = 0x1;
const uint CONNMGR_FLAG_PROXY_HTTP = 0x1;
const uint CONNMGR_PRIORITY_USERINTERACTIVE = 0x08000;
const uint INFINITE = 0xffffffff;
const uint CONNMGR_STATUS_CONNECTED = 0x10;
static Hashtable ht = new Hashtable();
static GPRSConnection()
{
ManualResetEvent mre = new ManualResetEvent(false);
mre.Handle = ConnMgrApiReadyEvent();
mre.WaitOne();
CloseHandle(mre.Handle);
}
~GPRSConnection()
{
ReleaseAll();
}
public static bool Setup(Uri url)
{
return Setup(url.ToString());
}
public static bool Setup(string urlStr)
{
ConnectionInfo ci = new ConnectionInfo();
IntPtr phConnection = IntPtr.Zero;
uint status = 0;
if (ht[urlStr] != null) return true;
if (ConnMgrMapURL(urlStr, ref ci.guidDestNet, IntPtr.Zero) != S_OK) return false;
ci.cbSize = (uint)Marshal.SizeOf(ci);
ci.dwParams = CONNMGR_PARAM_GUIDDESTNET;
ci.dwFlags = CONNMGR_FLAG_PROXY_HTTP;
ci.dwPriority = CONNMGR_PRIORITY_USERINTERACTIVE;
ci.bExclusive = 0;
ci.bDisabled = 0;
ci.hWnd = IntPtr.Zero;
ci.uMsg = 0;
ci.lParam = 0;
if (ConnMgrEstablishConnectionSync(ref ci, ref phConnection, INFINITE, ref status) != S_OK && status != CONNMGR_STATUS_CONNECTED)
return false;
ht[urlStr] = phConnection; return true;
}
public static bool Release(Uri url)
{
return Release(url.ToString());
}
public static bool Release(string urlStr)
{
return Release(urlStr, true);
}
private static bool Release(string urlStr, bool removeNode)
{
bool res = true;
IntPtr ph = IntPtr.Zero;
if (ht[urlStr] == null) return true;
ph = (IntPtr)ht[urlStr];
if (ConnMgrReleaseConnection(ph, 1) != S_OK) res = false;
CloseHandle(ph);
if (removeNode) ht.Remove(urlStr);
return res;
}
public static void ReleaseAll()
{
foreach (DictionaryEntry de in ht)
{
Release((string)de.Key, false);
}
ht.Clear();
}
[StructLayout(LayoutKind.Sequential)]
public struct ConnectionInfo
{
public uint cbSize;
public uint dwParams;
public uint dwFlags;
public uint dwPriority;
public int bExclusive;
public int bDisabled;
public Guid guidDestNet;
public IntPtr hWnd;
public uint uMsg;
public uint lParam;
public uint ulMaxCost;
public uint ulMinRcvBw;
public uint ulMaxConnLatency;
}
[DllImport("cellcore.dll")]
private static extern int ConnMgrMapURL(string pwszURL, ref Guid pguid, IntPtr pdwIndex);
[DllImport("cellcore.dll")]
private static extern int ConnMgrEstablishConnectionSync(ref ConnectionInfo ci, ref IntPtr phConnection, uint dwTimeout, ref uint pdwStatus);
[DllImport("cellcore.dll")]
private static extern IntPtr ConnMgrApiReadyEvent();
[DllImport("cellcore.dll")]
private static extern int ConnMgrReleaseConnection(IntPtr hConnection, int bCache);
[DllImport("coredll.dll")]
private static extern int CloseHandle(IntPtr hObject);

}
}

tober 2008-04-30
  • 打赏
  • 举报
回复
如果你手机是在外面用,最好用GPRS和WIFI,如果手机用数据线连接PC的,那就ActiveSync RDA,合并复制等发送到PC去.

顺便接分,哈哈
Mr.Chronos 2008-04-30
  • 打赏
  • 举报
回复
无人问津......
UP....
zipperman 2008-04-29
  • 打赏
  • 举报
回复
用ActiveSync吧

7,659

社区成员

发帖
与我相关
我的任务
社区描述
Windows Phone是微软发布的一款手机操作系统,它将微软旗下的Xbox LIVE游戏、Zune音乐与独特的视频体验整合至手机中。
社区管理员
  • Windows客户端开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧