2 * bluetooth-media-control
4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hocheol Seo <hocheol.seo@samsung.com>
7 * Girishashok Joshi <girish.joshi@samsung.com>
8 * Chanyeol Park <chanyeol.park@samsung.com>
11 * Licensed under the Apache License, Version 2.0 (the "License");
12 * you may not use this file except in compliance with the License.
13 * You may obtain a copy of the License at
15 * http://www.apache.org/licenses/LICENSE-2.0
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
27 #include "bluetooth-media-control.h"
30 #include <dbus/dbus-glib.h>
31 #include <dbus/dbus-glib-lowlevel.h>
33 #define MEDIA_ATRRIBUTE_LENGTH 256
35 media_player_settings_t player_settings = {0x00, 0x00, 0x00, 0x00, 0x01, 1111};
36 media_metadata_attributes_t metadata = {"Test Track", "Chethan", "TNC", "Tumkur", 1, 1, 14400};
38 void static __choose_metadata_settings(void)
41 media_metadata_attributes_t metadata = {0,};
44 printf("\nPlease enter\n");
45 printf("\t0: return to main menu\n");
46 printf("\t1: Meta data settings\n");
47 printf("\tEnter your choice [ ]\b\b");
56 metadata.title = calloc(1, MEDIA_ATRRIBUTE_LENGTH);
57 metadata.artist = calloc(1, MEDIA_ATRRIBUTE_LENGTH);
58 metadata.album = calloc(1, MEDIA_ATRRIBUTE_LENGTH);
59 metadata.genre = calloc(1, MEDIA_ATRRIBUTE_LENGTH);
61 printf("Enter the \"Track\" name\n");
62 scanf("%s", (char *)metadata.title);
64 printf(" Enter the \"Artist\" name\n");
65 scanf("%s", (char *)metadata.artist);
67 printf(" Enter the \"Album\" name\n");
68 scanf("%s", (char *)metadata.album);
70 printf(" Enter the \"Genre\" \n");
71 scanf("%s", (char *)metadata.genre);
73 printf(" Enter the \" Totol NumberOfTracks\" \n");
74 scanf("%d", &metadata.total_tracks);
76 printf(" Enter the \" Track Number\" \n");
77 scanf("%d", &metadata.number);
79 printf(" Enter the \"Duration\" \n");
80 scanf("%d", &metadata.duration);
85 bluetooth_media_player_change_track(&metadata);
87 if (NULL != metadata.title) {
88 free((void *)metadata.title);
89 metadata.title = NULL;
91 if (NULL != metadata.artist) {
92 free((void *)metadata.artist);
93 metadata.artist = NULL;
95 if (NULL != metadata.album) {
96 free((void *)metadata.album);
97 metadata.album = NULL;
99 if (NULL != metadata.genre) {
100 free((void *)metadata.genre);
101 metadata.genre = NULL;
106 void static __choose_player_settings(void)
109 media_player_property_type type;
112 printf("\nPlease choose player settings\n");
113 printf("\t0: return to main menu\n");
114 printf("\t1. Equalizer\n");
115 printf("\t2. Repeat\n");
116 printf("\t3. Shuffle\n");
117 printf("\t4. Scan \n");
118 printf("\t5. Status \n");
119 printf("\t6. Position \n");
120 printf("\tEnter your choice [ ]\b\b");
127 case 1: /* Equalizer */
129 printf("Possible Values - EQUALIZER_OFF = 0x00 and EQUALIZER_ON = 0x01,\n");
130 scanf("%d", &player_settings.equalizer);
133 bluetooth_media_player_change_property(type,
134 (unsigned int)player_settings.equalizer);
140 printf(" Possible Values - REPEAT_MODE_OFF = 0x00, REPEAT_SINGLE_TRACK = 0x01 , \
141 REPEAT_ALL_TRACK = 0x02, REPEAT_GROUP = 0x03\n");
142 scanf("%d", &player_settings.repeat);
145 bluetooth_media_player_change_property(type,
146 (unsigned int)player_settings.repeat);
149 case 3: /* Shuffle */
151 printf(" Possible Values - SHUFFLE_MODE_OFF = 0x00, SHUFFLE_ALL_TRACK = 0x01 , \
152 SHUFFLE_GROUP = 0x02\n");
153 scanf("%d", &player_settings.shuffle);
156 bluetooth_media_player_change_property(type,
157 (unsigned int)player_settings.shuffle);
162 printf(" Possible Values - SCAN_MODE_OFF = 0x00, SCAN_ALL_TRACK = 0x01 , \
163 SCAN_GROUP = 0x02\n");
164 scanf("%d", &player_settings.scan);
167 bluetooth_media_player_change_property(type,
168 (unsigned int)player_settings.scan);
173 printf(" Possible Values - STATUS_PLAYING = 0x00, STATUS_STOPPED = 0x01 , \
174 STATUS_PAUSED = 0x02,STATUS_FORWARD_SEEK = 0x03 \
175 STATUS_REVERSE_SEEK = 0x04 STATUS_ERROR = 0x05\n");
176 scanf("%d", &player_settings.status);
179 bluetooth_media_player_change_property(type,
180 (unsigned int)player_settings.status);
183 case 6: /* Position */
185 printf("Enter the possible value: ");
186 scanf("%d", &player_settings.position);
189 bluetooth_media_player_change_property(type,
190 player_settings.position);
201 GMainLoop *agent_loop;
205 agent_loop = g_main_loop_new(NULL, FALSE);
207 printf("MP-AV test application started\n");
209 printf("\n\n\t0. Exit\n");
210 printf("\t1. bluetooth_media_player_property_changed\n");
211 printf("\t2. bluetooth_media_player_track_changed\n");
212 printf("\tEnter your choice [ ]\b\b");
217 case 0: /* exit the application */
224 __choose_player_settings();
229 __choose_metadata_settings();
234 printf("gmain loop enter\n");
235 g_main_loop_run(agent_loop);
236 printf("gmain loop leave\n");