Exemple #1
0
void dmtx_oob_gdbus_create_paired_oob_device(const char *data, const char *oobrole)
{
        /* test xml file and either pass as raw xml or oob data
         first test as oob data */
        char *bdaddr;
        char *device_path;
        char *oobtags;
	int len;

        bdaddr = dmtxplugin_xml_parse_bdaddr(data);
        printf("Decoded bdadd: %s \n", bdaddr);
        /* parse length field and set len as get the length of optional oobtags  */
        len = dmtxplugin_xml_parse_len(data);
        printf("Decoded len: %d \n", len); /* TODO: reserve for future use */

        oobtags = dmtxplugin_xml_parse_oobtags(data);
        printf("Decoded oobtags: %s \n", oobtags);


        device_path = gdbus_create_paired_device(NULL, bdaddr, oobtags, oobrole, len);

        if (device_path)
                 printf("Paired Device created on path: %s \n ", device_path);
        else {
                printf("No response from plugin \n");
                printf("Paired Device creation failed\n");
        }

}
void dmtxplugin_gdbus_create_device(char *outfile)
{
        char *data;
        char *bdaddr;
        char *device_path;

        device_path = NULL;
        /* parse xml file containing bdaddr */
        if (g_file_get_contents (outfile, &data, NULL, NULL) == FALSE) {
                log_message("Couldn't load XML file %s\n", outfile);
                return;
        }

        bdaddr = dmtxplugin_xml_parse_bdaddr(data);
        log_message("Decoded bdadd: %s \n ", bdaddr);

        device_path = gdbus_device_create(NULL, bdaddr);
        log_message("Device created on path: %s \n ", device_path);

}