static char group_idx_b[MENU_DATA_SIZE + 1] = "2";
static char device_idx[MENU_DATA_SIZE + 1] = "1";
static char pin[MENU_DATA_SIZE + 1] = "11223344";
+static char message[MENU_DATA_SIZE + 1] = "Hello World!!";
void _device_invite_result_cb(int result, void *user_data)
{
return RET_SUCCESS;
}
+static int run_send_data(MManager *mm, struct menu_data *menu)
+{
+ int ret = 0;
+ int count = 0;
+ companion_device_h device = NULL;
+
+ count = g_list_length(found_device_list);
+
+ if (0 >= count ) {
+ msgr("No Device");
+ return RET_SUCCESS;
+ }
+
+ for (int i = 0; i < count; i++) {
+ device = (companion_device_h)(found_device_list[i].data);
+ ret = companion_send_data(device, message);
+ if (COMP_ERROR_NONE != ret) {
+ char *deviceid = NULL;
+ char *address = NULL;
+ companion_device_information_get_device_id(device, &deviceid);
+ companion_device_information_get_device_id(device, &address);
+ msgr("Failed to Send Data: [ID] %s [IP] %s", deviceid, address);
+ if (deviceid) {
+ free(deviceid);
+ deviceid= NULL;
+ }
+ if (address) {
+ free(address);
+ address= NULL;
+ }
+ }
+ }
+ return RET_SUCCESS;
+}
+
static struct menu_data menu_group_create[] = {
{ "0", "Group Name", NULL, NULL, groupid },
- { "2", "Run", NULL, run_group_create, NULL },
+ { "1", "Run", NULL, run_group_create, NULL },
{ NULL, NULL, },
};
static struct menu_data menu_group_find[] = {
{ "0", "Timeout", NULL, NULL, timeout },
- { "2", "Run", NULL, run_group_find, NULL },
+ { "1", "Run", NULL, run_group_find, NULL },
{ NULL, NULL, },
};
{ NULL, NULL, },
};
+static struct menu_data menu_send_data[] = {
+ { "0", "Message", NULL, NULL, message },
+ { "1", "Send (Broadcast)", NULL, run_send_data, NULL },
+ { NULL, NULL, },
+};
+
struct menu_data menu_comp_manager[] = {
{ "1", "Group Create", menu_group_create, NULL, NULL },
{ "2", "Find Groups", menu_group_find, NULL, NULL },
{ "10", "Get Found Devices", NULL, run_device_get_found, NULL },
{ "11", "Invite Device", menu_group_invite_device, NULL, NULL },
{ "12", "Eject Device", menu_group_eject_device, NULL, NULL },
+ { "13", "Send Message", menu_send_data, NULL, NULL },
{ NULL, NULL, },
};