OSDN Git Service

profile: Add MNS server record
authorChristian Fetzer <christian.fetzer@bmw-carit.de>
Tue, 9 Apr 2013 11:51:33 +0000 (13:51 +0200)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Wed, 10 Apr 2013 11:51:09 +0000 (14:51 +0300)
This adds the MNS server record to the profile default settings.

src/profile.c

index 29f9ee6..55e72dd 100644 (file)
                </attribute>                                            \
        </record>"
 
+#define MNS_RECORD                                                     \
+       "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>                    \
+       <record>                                                        \
+               <attribute id=\"0x0001\">                               \
+                       <sequence>                                      \
+                               <uuid value=\"0x1133\"/>                \
+                       </sequence>                                     \
+               </attribute>                                            \
+               <attribute id=\"0x0004\">                               \
+                       <sequence>                                      \
+                               <sequence>                              \
+                                       <uuid value=\"0x0100\"/>        \
+                               </sequence>                             \
+                               <sequence>                              \
+                                       <uuid value=\"0x0003\"/>        \
+                                       <uint8 value=\"0x%02x\"/>       \
+                               </sequence>                             \
+                               <sequence>                              \
+                                       <uuid value=\"0x0008\"/>        \
+                               </sequence>                             \
+                       </sequence>                                     \
+               </attribute>                                            \
+               <attribute id=\"0x0009\">                               \
+                       <sequence>                                      \
+                               <sequence>                              \
+                                       <uuid value=\"0x1134\"/>        \
+                                       <uint16 value=\"0x%04x\"/>      \
+                               </sequence>                             \
+                       </sequence>                                     \
+               </attribute>                                            \
+               <attribute id=\"0x0100\">                               \
+                       <text value=\"%s\"/>                            \
+               </attribute>                                            \
+               <attribute id=\"0x0200\">                               \
+                       <uint16 value=\"%u\" name=\"psm\"/>             \
+               </attribute>                                            \
+       </record>"
+
 #define SYNC_RECORD                                                    \
        "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>                    \
        <record>                                                        \
@@ -1709,6 +1747,20 @@ static char *get_mas_record(struct ext_profile *ext, struct ext_io *l2cap,
                                                                ext->name);
 }
 
+static char *get_mns_record(struct ext_profile *ext, struct ext_io *l2cap,
+                                                       struct ext_io *rfcomm)
+{
+       uint16_t psm = 0;
+       uint8_t chan = 0;
+
+       if (l2cap)
+               psm = l2cap->psm;
+       if (rfcomm)
+               chan = rfcomm->chan;
+
+       return g_strdup_printf(MNS_RECORD, chan, ext->version, ext->name, psm);
+}
+
 static char *get_sync_record(struct ext_profile *ext, struct ext_io *l2cap,
                                                        struct ext_io *rfcomm)
 {
@@ -1899,6 +1951,9 @@ static struct default_settings {
                .uuid           = OBEX_MNS_UUID,
                .name           = "Message Notification",
                .channel        = MNS_DEFAULT_CHANNEL,
+               .psm            = BTD_PROFILE_PSM_AUTO,
+               .get_record     = get_mns_record,
+               .version        = 0x0100
        },
 };