一.vcard的定义:
vCard: Thegeneric term for an electronic, virtual information card that can betransferred between computers, PDAs, or other electronic devices throughtelephone lines, or e-mail networks, or infrared links. How, when, why, andwhere vCard are used depends on the applications developed utilizing a vCard.
通俗来讲就是:电子名片
二.版本:
目前vcard已经经历了好几个版本:V2.1,V3.0,V4.0类似格式如图:
蓝牙中一般手机支持2.1版本的居多
三. Vcard spec:
1.vcard对象:一个vcard数据流可能包含几个vcard对象,所以就需要有一个定界符:BEGIN:VCARD
……
END:VCARD
2.属性:
每个属性的格式如下:
PropertyName [‘;‘PropertyParameters] ’:‘ PropertyValue
例:TEL;HOME:+1-919-555-1234
3.结束符:
每个属性的结束以\r\n结束,即ascii的13和10结束
四.属性识别(介绍一些常用的)
1.Formatted name(FN),name(N)FN表示一个vcard对象的名称,N表示这个对象名称的组成部分
N的格式分5个部分:FamilyName (first field), Given Name (second field), Additional Names (third field),Name Prefix (fourth field), and Name Suffix (fifth field),分别用’;’或者’,’间隔开
例如:N:Public;John;Quinlan;Mr.;Esq
N:Veni,Vidi, Vici;The Restaurant
2.photograph
这个在vcard中的属性名称是:PHOTO
例:PHOTO;VALUE=URL:file:///jqpublic.gif
另外,该属性存在编码方式和图片类型两个参数
例:PHOTO;ENCODING=BASE64;TYPE=GIF:
R0lGODdhfgA4AOYAAAAAAK+vr62trVIxa6WlpZ+fnzEpCEpzlAha/0Kc74+PjyGM
SuecKRhrtX9/fzExORBSjCEYCGtra2NjYyF7nDGE50JrhAg51qWtOTl7vee1MWu1
50o5e3PO/3sxcwAx/4R7GBgQOcDAwFoAQt61hJyMGHuUSpRKIf8A/wAY54yMjHtz
...
TYPE分:
Description | Property Parameter Value |
TYPE= |
|
Indicates Graphics Interchange Format | GIF |
Indicates ISO Computer Graphics Metafile | CGM |
Indicates MS Windows Metafile | WMF |
Indicates MS Windows Bitmap | BMP |
Indicates IBM PM Metafile | MET |
Indicates IBM PM Bitmap | PMB |
Indicates MS Windows DIB | DIB |
Indicates an Apple Picture format | PICT |
Indicates a Tagged Image File Format | TIFF |
Indicates Adobe PostScript format | PS |
Indicates Adobe Page Description Format | |
Indicates ISO JPEG format | JPEG |
Indicates ISO MPEG format | MPEG |
Indicates ISO MPEG version 2 format | MPEG2 |
Indicates Intel AVI format | AVI |
Indicates Apple QuickTime format | QTIME |
3.birthdat
以BDAY标示
例:BDAY:19950415
4.地址:
以ADR为标示,地址分7个域,分别是:
the Post Office Address (first field)Extended Address (second field), Street (third field), Locality (fourth field),Region (fifth field), Postal Code (six field), and Country (seventh field)
例:ADR;DOM;HOME:P.O. Box 101;Suite 101;123Main Street;Any Town;CA;91921-1234;
地址参数有个TYPE,分别为:
Description | Property Parameter Value |
TYPE= |
|
Indicates a domestic address | DOM |
Indicates an international address (Default) | INTL |
Indicates a postal delivery address (Default) | POSTAL |
Indicates a parcel delivery address (Default) | PARCEL |
Indicates a home delivery address | HOME |
Indicates a work delivery address (Default) | WORK |
|
|
5.LABLE类型:
和地址很像,区别是地址以’;’分开,但是LABEL是一串格式化的字符串
6.电话类型
以TEL标示,由于电话也有很多类型,所以同样以TYPE区分开,包括类型如下:
Description | Property Parameter Value |
TYPE= |
|
Indicates preferred number | PREF |
Indicates a work number | WORK |
Indicates a home number | HOME |
Indicates a voice number (Default) | VOICE |
Indicates a facsimile number | FAX |
Indicates a messaging service on the number | MSG |
Indicates a cellular number | CELL |
Indicates a pager number | PAGER |
Indicates a bulletin board service number | BBS |
Indicates a MODEM number | MODEM |
Indicates a car-phone number | CAR |
Indicates an ISDN number | ISDN |
Indicates a video-phone number | VIDEO |
|
|
例:TEL;WORK;HOME;VOICE;FAX:+1-800-555-1234
7.电子邮件
以EMAIL标示,同样电子邮件分很多种,以TYPE区分开,包括类型如下:
Description | Property Parameter Value |
TYPE= |
|
Indicates America On-Line | AOL |
Indicates AppleLink | AppleLink |
Indicates AT&T Mail | ATTMail |
Indicates CompuServe Information Service | CIS |
Indicates eWorld | eWorld |
Indicates Internet SMTP (default) | INTERNET |
Indicates IBM Mail | IBMMail |
Indicates MCI Mail | MCIMail |
Indicates PowerShare | POWERSHARE |
Indicates Prodigy information service | PRODIGY |
Indicates Telex number | TLX |
Indicates X.400 service | X400 |
以VERSION标示,目前一般存在2.1,3.0,4.0,
例:VERSION:2.1
另外:贴一张version2.1的例子: