开发者

How to capture inserting terminal to cradle

开发者 https://www.devze.com 2023-04-13 09:25 出处:网络
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

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

精彩评论

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