322
322
{ 0x1303, "VideoSource", NULL, 0 },
323
323
{ 0x1304, "VideoSink", NULL, 0 },
324
324
{ 0x1305, "VideoDistribution", NULL, 0 },
325
{ 0x1400, "MDP", NULL, 0 },
326
{ 0x1401, "MDPSource", NULL, 0 },
327
{ 0x1402, "MDPSink", NULL, 0 },
325
{ 0x1400, "HDP", NULL, 0 },
326
{ 0x1401, "HDPSource", NULL, 0 },
327
{ 0x1402, "HDPSink", NULL, 0 },
328
328
{ 0x2112, "AppleAgent", NULL, 0 },
1817
static int add_pbap(sdp_session_t *session, svc_info_t *si)
1819
sdp_list_t *svclass_id, *pfseq, *apseq, *root;
1820
uuid_t root_uuid, pbap_uuid, l2cap_uuid, rfcomm_uuid, obex_uuid;
1821
sdp_profile_desc_t profile[1];
1822
sdp_list_t *aproto, *proto[3];
1823
sdp_record_t record;
1824
uint8_t chan = si->channel ? si->channel : 19;
1825
sdp_data_t *channel;
1826
uint8_t formats[] = {0x01};
1827
uint8_t dtd = SDP_UINT8;
1831
memset(&record, 0, sizeof(sdp_record_t));
1832
record.handle = si->handle;
1834
sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
1835
root = sdp_list_append(0, &root_uuid);
1836
sdp_set_browse_groups(&record, root);
1838
sdp_uuid16_create(&pbap_uuid, PBAP_PSE_SVCLASS_ID);
1839
svclass_id = sdp_list_append(0, &pbap_uuid);
1840
sdp_set_service_classes(&record, svclass_id);
1842
sdp_uuid16_create(&profile[0].uuid, PBAP_PROFILE_ID);
1843
profile[0].version = 0x0100;
1844
pfseq = sdp_list_append(0, profile);
1845
sdp_set_profile_descs(&record, pfseq);
1847
sdp_uuid16_create(&l2cap_uuid, L2CAP_UUID);
1848
proto[0] = sdp_list_append(0, &l2cap_uuid);
1849
apseq = sdp_list_append(0, proto[0]);
1851
sdp_uuid16_create(&rfcomm_uuid, RFCOMM_UUID);
1852
proto[1] = sdp_list_append(0, &rfcomm_uuid);
1853
channel = sdp_data_alloc(SDP_UINT8, &chan);
1854
proto[1] = sdp_list_append(proto[1], channel);
1855
apseq = sdp_list_append(apseq, proto[1]);
1857
sdp_uuid16_create(&obex_uuid, OBEX_UUID);
1858
proto[2] = sdp_list_append(0, &obex_uuid);
1859
apseq = sdp_list_append(apseq, proto[2]);
1861
aproto = sdp_list_append(0, apseq);
1862
sdp_set_access_protos(&record, aproto);
1864
sflist = sdp_data_alloc(dtd,formats);
1865
sdp_attr_add(&record, SDP_ATTR_SUPPORTED_REPOSITORIES, sflist);
1867
sdp_set_info_attr(&record, "OBEX Phonebook Access Server", 0, 0);
1869
if (sdp_device_record_register(session, &interface, &record,
1870
SDP_RECORD_PERSIST) < 0) {
1871
printf("Service Record registration failed\n");
1876
printf("PBAP service registered\n");
1879
sdp_data_free(channel);
1880
sdp_list_free(proto[0], 0);
1881
sdp_list_free(proto[1], 0);
1882
sdp_list_free(proto[2], 0);
1883
sdp_list_free(apseq, 0);
1884
sdp_list_free(aproto, 0);
1823
1889
static int add_ftp(sdp_session_t *session, svc_info_t *si)
1825
1891
sdp_list_t *svclass_id, *pfseq, *apseq, *root;
2179
2245
static const uint16_t intr = 0x13;
2180
2246
static const uint16_t hid_attr[] = { 0x100, 0x111, 0x40, 0x0d, 0x01, 0x01 };
2181
2247
static const uint16_t hid_attr2[] = { 0x0, 0x01, 0x100, 0x1f40, 0x01, 0x01 };
2182
const uint8_t hid_spec[] = {
2248
const uint8_t hid_spec[] = {
2183
2249
0x05, 0x01, // usage page
2184
2250
0x09, 0x06, // keyboard
2185
2251
0xa1, 0x01, // key codes
3424
static int add_gatt(sdp_session_t *session, svc_info_t *si)
3426
sdp_list_t *svclass_id, *apseq, *proto[2], *profiles, *root, *aproto;
3427
uuid_t root_uuid, proto_uuid, gatt_uuid, l2cap;
3428
sdp_profile_desc_t profile;
3429
sdp_record_t record;
3430
sdp_data_t *psm, *sh, *eh;
3431
uint16_t att_psm = 27, start = 0x0001, end = 0x000f;
3434
memset(&record, 0, sizeof(sdp_record_t));
3435
record.handle = si->handle;
3436
sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
3437
root = sdp_list_append(NULL, &root_uuid);
3438
sdp_set_browse_groups(&record, root);
3439
sdp_list_free(root, NULL);
3441
sdp_uuid16_create(&gatt_uuid, GENERIC_ATTRIB_SVCLASS_ID);
3442
svclass_id = sdp_list_append(NULL, &gatt_uuid);
3443
sdp_set_service_classes(&record, svclass_id);
3444
sdp_list_free(svclass_id, NULL);
3446
sdp_uuid16_create(&profile.uuid, GENERIC_ATTRIB_PROFILE_ID);
3447
profile.version = 0x0100;
3448
profiles = sdp_list_append(NULL, &profile);
3449
sdp_set_profile_descs(&record, profiles);
3450
sdp_list_free(profiles, NULL);
3452
sdp_uuid16_create(&l2cap, L2CAP_UUID);
3453
proto[0] = sdp_list_append(NULL, &l2cap);
3454
psm = sdp_data_alloc(SDP_UINT16, &att_psm);
3455
proto[0] = sdp_list_append(proto[0], psm);
3456
apseq = sdp_list_append(NULL, proto[0]);
3458
sdp_uuid16_create(&proto_uuid, ATT_UUID);
3459
proto[1] = sdp_list_append(NULL, &proto_uuid);
3460
sh = sdp_data_alloc(SDP_UINT16, &start);
3461
proto[1] = sdp_list_append(proto[1], sh);
3462
eh = sdp_data_alloc(SDP_UINT16, &end);
3463
proto[1] = sdp_list_append(proto[1], eh);
3464
apseq = sdp_list_append(apseq, proto[1]);
3466
aproto = sdp_list_append(NULL, apseq);
3467
sdp_set_access_protos(&record, aproto);
3469
sdp_set_info_attr(&record, "Generic Attribute Profile", "BlueZ", NULL);
3471
sdp_set_url_attr(&record, "http://www.bluez.org/",
3472
"http://www.bluez.org/", "http://www.bluez.org/");
3474
sdp_set_service_id(&record, gatt_uuid);
3476
ret = sdp_device_record_register(session, &interface, &record,
3477
SDP_RECORD_PERSIST);
3479
printf("Service Record registration failed\n");
3481
printf("Generic Attribute Profile Service registered\n");
3486
sdp_list_free(proto[0], NULL);
3487
sdp_list_free(proto[1], NULL);
3488
sdp_list_free(apseq, NULL);
3489
sdp_list_free(aproto, NULL);
3360
3496
uint32_t class;
3376
3512
{ "HF", HANDSFREE_SVCLASS_ID, add_handsfree },
3377
3513
{ "HFAG", HANDSFREE_AGW_SVCLASS_ID, add_handsfree_ag},
3378
3514
{ "SAP", SAP_SVCLASS_ID, add_simaccess },
3379
{ "PBAP", PBAP_SVCLASS_ID, NULL, },
3515
{ "PBAP", PBAP_SVCLASS_ID, add_pbap, },
3381
3517
{ "NAP", NAP_SVCLASS_ID, add_nap },
3382
3518
{ "GN", GN_SVCLASS_ID, add_gn },