Thursday, September 25, 2008

Conditional Breakpoint in Platform Builder for Windows CE and Mobile

I've had a hard time figuring out how to set conditional breakpoint in Platform Builder. No much useful information is available on the web, and the documentation does not even give an example.

So, here are the findings. The same expression rules apply to Watch window as well.

  • You can use register names directly in an expression. For example, you can set 'r1 == 0x200' as a condition in the context of a function. So whenever r1 is 0x200 it will break;
  • You can use type cast to see the fields of a struct and set breakpoint. For example, in a Watch window, you can type "(struct sockaddr*)r1" to view the sockaddr members that pointed by r1.
  • Use "*" with type cast to view a variable. For example, use *(short*)(r3) to view a SHORT variable pointed by r3.

Here is a little bit complicated example. Let's say I want to break WSAConnect() is ws2.dll only when the port number to connect is 80, the HTTP port. I know that the second parameter passed to this function is a sockaddr struct pointer. To create such a breakpoint, first enter the following as a breakpoint entry:

{,,ws2.dll} WSAConnect

Then hit the 'condition' button, and enter the following

*(short*)(r1+2) == 0x5000

r1 will carry the 2nd parameter, the sockaddr pointer. 0x5000 refers to port 80 because network byte order is always big-endian and the device I am using turns out to be little-endian.

The breakpoint window will look like this:

When the breakpoint is hit, a message box will pop up:

Computing: "Save To My SkyDrive"

What does Cloud Computing (CC) mean to me? Two services for now:

Microsoft SkyDrive is a service to store and share files on the web, and Google Docs enables online editing and sharing of documents and calendars. (Google Gear allows offline editing).

One feature missing from both services is what I call the "Save To My SkyDrive" on the "File" menu, with which you can edit your stuff in your client application and save it directly to your SkyDrive. Even better, you should be able to create a network drive that maps your SkyDrive to a drive letter, and drag and drop your stuff directly into the drive.

Looking ahead, I expect a lot (probably not all) of your communication materials on your hard drive will be actually just local copies of the same stuff in the cloud. We already have emails stored somewhere on the Internet so we can access anywhere, anytime, from any computer. We will see a lot more going this direction: your Office docs, your calendar, your personal documents, your health care record, your family photos, etc. In other words, the web, or the cloud, is your big "My Documents" folder, and you are either working offline with some client applications such as Microsoft Office and sync with the cloud later, or working online using web browser based applications to edit your files directly.

The files are not even stored and managed in one single place - for example, your family video may not be saved as a single file on Cloud Server # 314 at Mountain View, CA. Instead, pieces of this file may be stored in various places in New York City, Phoenix, Chicago, and Seattle, and some networking coding scheme is employed to achieve excellent performance and reliability (P2P users should know what I mean here).

And your mobile devices should be doing the same thing - offline editing and online syncing to your corner in the cloud.

One word: web-sourcing. We will see our local storage sourced to the cloud, and a lot of our communications (file editing and review, meeting request, trip planning and expense tracking, etc) can be sourced to the cloud as well.

Why are we heading this way? Two reasons:

  1. Files in your local storage can not be shared with others easily; How often do you have to send attachments of file copies back and forth to your colleagues and family, and to yourself?
  2. How much space do you really need to store your docs/videos/mp3/books? I always need more space ...

Is this trend killing box software manufacturers like Microsoft? Not at all. Client applications are still much more powerful and user-friendly than those browser-based solutions. People still need them. The client software just need to be more CC-ready, creating an enriched user experience that is closely, naturally integrated into the web.

This requires a company-wide initiative to be successful, something like Cloud-Ready Computing (CRC (r) all rights reserved) , just like what Microsoft did with security (Trustworthy Computing). Small features such as "Save To My SkyDrive" should be identified by every participating product group, and the Windows Live services should be extended to provide could hosting, and the Windows Mobile platform should be Cloud-Ready together with other Microsoft products as well instead of always playing the porting/catching-up game.

Update: Microsoft Office Live Workspace (beta) offers similar service as Google Docs.

Publishing a Bluetooth Serial Port Profile on a Windows Mobile phone

Some Windows Mobile partners asked me lately about publishing Serial Port Profile on a Windows Mobile phone. We know that a Windows Mobile phone usually publishes DUN (Dial-up Networking) service, which is based on SPP. What if you want to publish an additional SPP so your phone and the desktop can have an additional communication channel?

In Windows Mobile AKU 6, you can find a sample program (public\common\sdk\samples\bluetooth\bthnscreate) that demonstrates how to use a profile record file (.rec) to generate C code that can be used to publish a service on a device. However, the sample does not provide a rec file for SPP.

Well, here is an example of SPP record file you can use. For details of this record file format, you should get a copy of Bluetooth Profile specification and read Part K:5 Serial Port Profile.

-------------------------------------------------------------------------------------------

1 SEQUENCE

; SPP class ID

UUID16 1101

END

4 SEQUENCE

SEQUENCE

; L2CAP protocol identifier

UUID16 100

END

SEQUENCE

; RFCOMM protocol identifier

UUID16 3

; NOTE: SPP is not guaranteed to run on RFCOMM channel A.

; This value may need to change at run time to appropriate channel.

UINT8 A

END

END

6 SEQUENCE

; language base ID information

UINT16 656E

UINT16 6A

UINT16 100

END

100 STRING SPP

-------------------------------------------------------------------------------------------

Using the bthncreate tool with this record file, you can create a C source file. Then if you follow the WSASetService() example at the bottom of the page (http://msdn2.microsoft.com/en-us/library/aa450140.aspx), you can quickly write some code to call WSASetService with the rgbSdpRecord[] array in the created C source file. Of course, before you call WSASetService, you must first initialize winsock by calling WSAStartup, and clean up by calling WSACleanup.

Here the caveat is that once the phone publishes an additional SPP, the Bluetooth stack on the desktop will automatically create an incoming port and an outgoing port once they are paired. This makes legacy applications on the desktop continue to perform virtual com port based communication.

Of course, an easier way to create a channel for communication between a Windows Mobile device and a Windows desktop is to use Bluetooth socket. Please see http://msdn2.microsoft.com/en-us/library/aa362928%28VS.85%29.aspx (desktop BT socket) and http://msdn2.microsoft.com/en-us/library/aa362928%28VS.85%29.aspx (Windows CE BT socket) for details.

Configuring IMAP Based Gmail on Windows Mobile 6.1

On Windows Mobile 6 phones, if you want to add Gmail to the email account list, there will be a wizard that automatically configures your Gmail account using POP3, which works fine.

However, as Google just enabled IMAP access for Gmail, you may want to switch over to IMAP because that way you can view the same set of folders/emails right on the server without downloading a local copy.

The problem is, how to bypass that automatic email setup wizard (it always sets up using POP3 once you entered your gmail account at the first step)?

Play this trick: when you are first prompted to enter your email address, just type in some garbage like aaa@bbb.com. Then you will not be forced to use that automatic setup wizard (POP3); instead, select IMAP as the account type, then manually type in IMAP server and SMTP server addresses as described here. After that, go back to the account settings, change your email address to the real one you use with Gmail.

Well, yes, there should be a better way of bypassing that wizard.

Update: It turns out on Windows Mobile 6, there is a box you can uncheck to disable 'Get Settings automatically from the Internet". On 6.1, however, no such option exisit.

How Many Days to Reach 1 Million?

Last year, iPhone took 74 days to reach 1 million.

HTC Touch took about 5 months to get that number.

This year, the 1 million mark was reached just 3 days after iPhone 2.0 was launched. Now the total iPhone volume has reportedly reached 7 million. Their goal of getting 10 million iPhone shipped by the end of 2008 is well within reach.

I don't have an iPhone 3G. Ironically some people from our customer-facing team often bring their own iPhone to our Windows Mobile partners, which I think is politically incorrect. Anyhow, I tried an iPhone 3G a bit and still the user experience is superior and exchange email sync worked fine.

Meanwhile, there is another big monster lurking around the corner - the Google Android phones. Oh, yes you can say as of today there is no such phone so the ratio of Windows Mobile to Android is 18 million to ZERO, so it is infinite. Great.

But, until 6/29/2007, the ratio of Windows Mobile to iPhone was infinite as well...

Wednesday, October 18, 2006

Did you try JAJAH?

Check out the free web based phone call service from JAJAH - web-activated telephony.

Basically the service will connect your phone (cell phone or a landline) to the number you dialed. The service can be totally free (as calling US, Canada, China, HK, etc), or with a fee of some centers per minutes. Quality is good.

I am using a phone card (2.2 cents per minutes) to call China landlines. With Jajah, I will pay nothing.

Thursday, October 13, 2005

IM convergence

MSN and Yahoo have agreed to open their priprietary networks to each other to allow interoperability. AOL is in limbo. Not clear about Google's new adventure in IM.

Wednesday, August 31, 2005

Slashdot | New IrDA Spec Shoots for 100Mbit/s Data Rate

Infrared has been generally considered a low-tech compared with Bluetooth because of its data rate. Now the new IrDA spec comes out with a peak data rate of 100Mbit/s, way faster than Bluetooth 2.0.

Still, this is line-of-sight and you must carefully align two IrDA ports to establish a connection.

How about power consumption? Not mentioned in the article.



Monday, August 29, 2005

Big Screen Viewing Effect For Mobile Phone Videos

This is one way to solve the tiny-screen problem for Mobile Video on cell phones: DigitalCamera@101reviews � Big Screen Viewing Effect For Mobile Phone Videos.

The projected screen is about 12-inch as seen from three feet away. The resolution is 320*240 QVGA. Not bad.

Saturday, August 27, 2005

Business 2.0 - The $50 Million Giveaway

Got an idea of a startup? Check out the $50 million giveaway on Business 2.0. The article lists a bunch of very cool ideas that VCs are seeking for business plans.

You will notice that most projects are mobile and wireless related. Smarter phones for RFID based mobile payment, mobile social networking, plug-n-play mobile services, and so on.

Just wondering if these ideas could be possibly ported to other countries....

Sunday, July 10, 2005

Palm v.s. PPC showdown

Fact is Palm is losing the PDA market to PPC devices. Microsoft successfully (so far) broke into this market.

How did Palm fight back?

1) split into Palm One and Palm Source; then Palm One will switch back to its original name Palm
2) merged with handspring
3) came up with Treo smart phone series and LifeDrive mobile manager
4) Palm OS Cobalt 6.1

As consumers, we do like this kind of diversity.

Apple moves to become an MVNO

The story @Forbes.com talks about Apple's move toward MVNO (mobile virtual network operator), i.e., reaching its customers (with value-add content and services) through a cellular/WiFi infrastructure provided by some MNO like Sprint or Cingular. This is a new business model in the wireless world, and a number of companies are doing the same thing, including Wal-mart, ESPN, Disney, and so on.

This is particularly interesting if you follow Apple's recent business moves: it partner with Motorola on a cell phone running iTunes; it will dump PowerPC; and many people believe Apple is developing an iPhone (an iPod cell phone).

Given the ever-increasing, huge number of mobile wireless devices being used in the world, and the fact that people will like to pay for anything cool and useful if priced well, no wonder many high-profile companies (computer, communication, consumer-electronics, media, etc) are trying very hard to catch the wave. Go wireless!