4 * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
22 #include "bluetooth-media-control.h"
25 #include <dbus/dbus-glib.h>
26 #include <dbus/dbus-glib-lowlevel.h>
28 #define MEDIA_ATRRIBUTE_LENGTH 256
30 media_player_settings_t player_settings = {0x00, 0x00, 0x00, 0x00, 0x01, 1111};
31 media_metadata_attributes_t metadata = {"Test Track", "Chethan", "TNC", "Tumkur", 1, 1, 14400};
33 void static __choose_metadata_settings(void)
36 media_metadata_attributes_t metadata = {0,};
39 printf("\nPlease enter\n");
40 printf("\t0: return to main menu\n");
41 printf("\t1: Meta data settings\n");
42 printf("\tEnter your choice [ ]\b\b");
51 metadata.title = calloc(1, MEDIA_ATRRIBUTE_LENGTH);
52 metadata.artist = calloc(1, MEDIA_ATRRIBUTE_LENGTH);
53 metadata.album = calloc(1, MEDIA_ATRRIBUTE_LENGTH);
54 metadata.genre = calloc(1, MEDIA_ATRRIBUTE_LENGTH);
56 printf("Enter the \"Track\" name\n");
57 scanf("%s", (char *)metadata.title);
59 printf(" Enter the \"Artist\" name\n");
60 scanf("%s", (char *)metadata.artist);
62 printf(" Enter the \"Album\" name\n");
63 scanf("%s", (char *)metadata.album);
65 printf(" Enter the \"Genre\" \n");
66 scanf("%s", (char *)metadata.genre);
68 printf(" Enter the \" Totol NumberOfTracks\" \n");
69 scanf("%d", &metadata.total_tracks);
71 printf(" Enter the \" Track Number\" \n");
72 scanf("%d", &metadata.number);
74 printf(" Enter the \"Duration\" \n");
75 scanf("%d", &metadata.duration);
80 bluetooth_media_player_change_track(&metadata);
82 if (NULL != metadata.title) {
83 free((void *)metadata.title);
84 metadata.title = NULL;
86 if (NULL != metadata.artist) {
87 free((void *)metadata.artist);
88 metadata.artist = NULL;
90 if (NULL != metadata.album) {
91 free((void *)metadata.album);
92 metadata.album = NULL;
94 if (NULL != metadata.genre) {
95 free((void *)metadata.genre);
96 metadata.genre = NULL;
101 void static __choose_player_settings(void)
104 media_player_property_type type;
107 printf("\nPlease choose player settings\n");
108 printf("\t0: return to main menu\n");
109 printf("\t1. Equalizer\n");
110 printf("\t2. Repeat\n");
111 printf("\t3. Shuffle\n");
112 printf("\t4. Scan \n");
113 printf("\t5. Status \n");
114 printf("\t6. Position \n");
115 printf("\tEnter your choice [ ]\b\b");
122 case 1: /* Equalizer */
124 printf("Possible Values - EQUALIZER_OFF = 0x00 and EQUALIZER_ON = 0x01,\n");
125 scanf("%d", &player_settings.equalizer);
128 bluetooth_media_player_change_property(type,
129 (unsigned int)player_settings.equalizer);
135 printf(" Possible Values - REPEAT_MODE_OFF = 0x00, REPEAT_SINGLE_TRACK = 0x01 , \
136 REPEAT_ALL_TRACK = 0x02, REPEAT_GROUP = 0x03\n");
137 scanf("%d", &player_settings.repeat);
140 bluetooth_media_player_change_property(type,
141 (unsigned int)player_settings.repeat);
144 case 3: /* Shuffle */
146 printf(" Possible Values - SHUFFLE_MODE_OFF = 0x00, SHUFFLE_ALL_TRACK = 0x01 , \
147 SHUFFLE_GROUP = 0x02\n");
148 scanf("%d", &player_settings.shuffle);
151 bluetooth_media_player_change_property(type,
152 (unsigned int)player_settings.shuffle);
157 printf(" Possible Values - SCAN_MODE_OFF = 0x00, SCAN_ALL_TRACK = 0x01 , \
158 SCAN_GROUP = 0x02\n");
159 scanf("%d", &player_settings.scan);
162 bluetooth_media_player_change_property(type,
163 (unsigned int)player_settings.scan);
168 printf(" Possible Values - STATUS_PLAYING = 0x00, STATUS_STOPPED = 0x01 , \
169 STATUS_PAUSED = 0x02,STATUS_FORWARD_SEEK = 0x03 \
170 STATUS_REVERSE_SEEK = 0x04 STATUS_ERROR = 0x05\n");
171 scanf("%d", &player_settings.status);
174 bluetooth_media_player_change_property(type,
175 (unsigned int)player_settings.status);
178 case 6: /* Position */
180 printf("Enter the possible value: ");
181 scanf("%d", &player_settings.position);
184 bluetooth_media_player_change_property(type,
185 player_settings.position);
196 GMainLoop *agent_loop;
200 agent_loop = g_main_loop_new(NULL, FALSE);
202 printf("MP-AV test application started\n");
204 printf("\n\n\t0. Exit\n");
205 printf("\t1. bluetooth_media_player_property_changed\n");
206 printf("\t2. bluetooth_media_player_track_changed\n");
207 printf("\tEnter your choice [ ]\b\b");
212 case 0: /* exit the application */
219 __choose_player_settings();
224 __choose_metadata_settings();
229 printf("gmain loop enter\n");
230 g_main_loop_run(agent_loop);
231 printf("gmain loop leave\n");