开发者

How to capture inserting terminal to cradle

How to capture inserting terminal to cradle and make this tests?

i need to check 3 things:

1. if th开发者_StackOverflowe terminal is in the cradle
2. if i got IP
3. if there is connection to my WebService

and after this, i need to transfer data between my WebService to the terminal (Windows-mobile 6.5)

how i can do it ?


There is a namespace Microsoft.WindowsMobile.Status

In there you can find relevant information about your device.

For example, I have used the following snippet to know if an active desktop connection is present.

Microsoft.WindowsMobile.Status.SystemState.ConnectionsDesktopCount <= 0 

Also there is this property, never used it.

Microsoft.WindowsMobile.Status.SystemState.CradlePresent

For the IP part.

//Get Device Name
var deviceName = System.Net.Dns.GetHostName();
 //Get IP Address
IPHostEntry _ipHost = System.Net.Dns.GetHostEntry(deviceName);
var IpAddress = _ipHost.AddressList[0].ToString();

For the connection to your webservice, you can create bool or int simple method to test if it is available.

Webservice

bool IsAvailable()
{
return true;
}

You just need to call the webservice.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜