Linux bluetooth development
 help / color / mirror / Atom feed
From: Ka Kin Cheung <michaelhku2002@yahoo.com.hk>
To: bluez-users@lists.sourceforge.net
Subject: Re: [Bluez-users] rfcomm question 3
Date: Sat, 19 Feb 2005 21:45:36 +0800 (CST)	[thread overview]
Message-ID: <20050219134536.65862.qmail@web60905.mail.yahoo.com> (raw)
In-Reply-To: <42170F9B.8000508@gmx.ch>

[-- Attachment #1: Type: text/plain, Size: 8089 bytes --]

Hi Marco!
    I'm surprising that you are quite interested about
my project as you didn't do about the thing what I've
done, I think.
    Regarding to your questions:
1.> what service is on rfcomm channel 0 on the mobile
phone? obex?
    Sorry, I'm not sure what you are asking. But about
OBEX, after I did for "sdptool browse <address>" for
my T610, following occurs
Service Name: Dial-up Networking
Service RecHandle: 0x10000
Service Class ID List:
  "Dialup Networking" (0x1103)
  "Generic Networking" (0x1201)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 1
Profile Descriptor List:
  "Dialup Networking" (0x1103)
    Version: 0x0100
 
Service Name: Voice gateway
Service RecHandle: 0x10002
Service Class ID List:
  "Headset Audio Gateway" (0x1112)
  "Generic Audio" (0x1203)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 3
Profile Descriptor List:
  "Headset" (0x1108)
    Version: 0x0100
 
Service Name: Serial Port 1
Service RecHandle: 0x10003
Service Class ID List:
  "Serial Port" (0x1101)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 4
 
Service Name: Serial Port 2
Service RecHandle: 0x10004
Service Class ID List:
  "Serial Port" (0x1101)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 5
 
Service Name: OBEX Object Push
Service RecHandle: 0x10005
Service Class ID List:
  "OBEX Object Push" (0x1105)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 10
  "OBEX" (0x0008)
Profile Descriptor List:
  "OBEX Object Push" (0x1105)
    Version: 0x0100
 
Service Name: IrMC Synchronization
Service RecHandle: 0x10006
Service Class ID List:
  "IrMCSync" (0x1104)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 11
  "OBEX" (0x0008)
Profile Descriptor List:
  "IrMCSync" (0x1104)
    Version: 0x0100
 
Service Name: HF Voice gateway
Service RecHandle: 0x10007
Service Class ID List:
  "" (0x111f)
  "Generic Audio" (0x1203)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 6
Profile Descriptor List:
  "" (0x111e)
    Version: 0x0100
 
Service Name: OBEX Basic Imaging
Service RecHandle: 0x1000b
Service Class ID List:
  "" (0x111b)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 15
  "OBEX" (0x0008)
Profile Descriptor List:
  "" (0x111a)
    Version: 0x0100
 
Service Name: OBEX File Transfer
Service RecHandle: 0x1000f
Service Class ID List:
  "OBEX File Transfer" (0x1106)
Protocol Descriptor List:
  "L2CAP" (0x0100)
  "RFCOMM" (0x0003)
    Channel: 7
  "OBEX" (0x0008)
Profile Descriptor List:
  "OBEX File Transfer" (0x1106)
    Version: 0x0100

    If regarding the above output, the service I wish
to use should be OBEX OIbject Push, and it is in
channel 10. Am I right?
2.>It wouldn't make sense, because the mobile phone
has no idea what
> to do after it connected, does it?
So what I have to do is, after the mobile phone
connect to PC, the menu could be sent to the mobile
phone's "accessories" menu and then run. As you are
interested in what I've done for connecting PC to T610
and then do my work, I attached a file here. It is one
of my project's program where the phone is connected
from PC. You can see how it works with T610 (if you
have T610. Or if not, any Sony Ericsson T series phone
may be ok.) But there are notes here:
1.There are lines that are MySQL API. So, I'll send
also the SQL files and then you have to create
AVDevice database.
2.The IR part is using IRTrans transceiver (maybe you
have heard about it). But you can ignore any error
message caused by IRTrans as it doesn't affect the
operation about bluetooth. 
    Thank you very much for your kindness and
interest.
Michael

 --- Marco Trudel <mtrudel@gmx.ch> 內容:
> Hello Michael
> 
> finally I understand what you're trying to do. that
> explains a lot!
> I would have been confused too if somone told me
> about socket programming
> while doing what you do.
> I suggest to add a description of what you do when
> posting to a mailinglist
> the next time. That might save a lot of time :-)
> 
> > Yes, of course, and the connection layer is
> rfcomm. I typed "rfcomm
> > connect 0 <address>" to connect to T610, and it
> was success.
> 
> what service is on rfcomm channel 0 on the mobile
> phone? obex?
> 
> 
> Ok. So now you try
> 1. to connect with your mobile phone to the pc
> 2. send the menu from the pc to the mobile phone
> 3. do what already worked before...
> 
> As far as I know - please correct me if someone
> knows better - a mobile
> phone doesn't provide a feature to connect to remote
> devices (at least mine
> doesn't). It wouldn't make sense, because the mobile
> phone has no idea what
> to do after it connected, does it?
> I wonder how your tutor made this. If he tells you,
> could you send this to
> the list? I'm really interested...
> 
> Actually I think you now have to write/download a
> program for your mobile
> phone that connects to an obex (if you're working
> with obex) service (on
> your pc) - or ask your tutor how he did it...
> Then you can send the menu from to pc to the mobile
> phone and everything
> should be fine.
> And here now comes the sdp thing that your tutor
> mentioned. Your mobile
> phone will do a service scan on your pc (paging),
> then it should find a
> obex service that it knows it's able to connect to.
> 
> Can I have your program that sent the menu from the
> pc to the mobile phone?
> I never worked with something like this but I'm be
> very interested how this
> looks/works. I don't mind that I've to connect from
> the pc to the mobile
> phone...
> 
> Please inform me of any success/failures (after you
> described what you do,
> i'm really interested in it - you might already have
> noticed it).
> 
> 
> regards
> Marco
> 
> 
> Ka Kin Cheung wrote:
> > Hi Marco!
> >     Thanks for you reply as I afraid that you may
> not reply my mail due 
> > to my ridicious act before.
> >     Regarding to your questions:
> > 1.>The connection between your mobile phone and
> your pc is over 
> > bluetooth >and your pc then sends the infrared
> signals to the 
> > television, is this correct?
> > Yes, correct.
> > 2.>You were able to connect from your pc to the
> mobile phone. Did you use
> >  >bluetooth?
> > Yes, of course, and the connection layer is
> rfcomm. I typed "rfcomm 
> > connect 0 <address>" to connect to T610, and it
> was success. Now what I 
> > do is to change the approach, but still it is not
> successful.
> > 3.>Which service do you connected to (from your
> mobile phone), what's 
> > it's >name?
> > The service that the PC provided for T610 is
> Object push
> > 4.>Then you sent the menu for the remote control
> from your pc to your mobile
> >  >phone using at commands and got the choices you
> made on the mobile 
> >  >phone bacck to your pc. Your pc then sent the
> answer to the television 
> >  >using infrared?
> > Exactly!
> > 
> >  >Hope I understood this more or less correctly...
> > I'm glad that you understand much about my
> project. So I hope that you 
> > can point out something about how I do for sdp so
> that I can eventually 
> > let the T610 to connect to PC while my main
> program is running.
> > Thanks so much.
> > Michael
> > 
> > 
> >
>
------------------------------------------------------------------------
> > Yahoo! 工具列 - 內置防止彈出視窗工能
> <http://hk.toolbar.yahoo.com>!
> 
> 
>
-------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT
> Products from real users.
> Discover which products truly live up to the hype.
> Start reading now.
>
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Bluez-users mailing list
> Bluez-users@lists.sourceforge.net
>
https://lists.sourceforge.net/lists/listinfo/bluez-users
>  

_______________________________________________________________________
Yahoo! 工具列 - 內置防止彈出視窗工能!
http://toolbar.yahoo.com.hk

[-- Attachment #2: bic_michael2.c --]
[-- Type: application/octet-stream, Size: 17590 bytes --]

/*****************************************************************************/

/*** (Final Year Project Bluetooth-Infrared Converter) bic_michael.c  	   ***/

/***                                                  Michael Cheung Ka Kin***/

/*****************************************************************************/

  

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <sys/time.h>
#include <string.h>
#include <termios.h>
#include <syslog.h>

#include <modeminit.h>
#include <modeminit.c>
#include <logging.c>
#include <logging.h>
#include <extras.h>
#include <extras.c>
#include <locking.c>
#include <locking.h>
#include <alarm.h>
#include <alarm.c>

#include <sys/file.h>

#include <mysql/mysql.h>

char filename[500] = { 0 };
char logfile[256] = { 0 };
char alarmhandler[256] = { 0 };
int alarmlevel = LOG_WARNING;
int loglevel = 9;
int ret_code;
char tmp[100];
char command[1024];//used for AT command only for creating menu
char buffer[1024];//used for AT command only when the number of choice1 is dynamic
char answer[1024];//used for the command for the Linux PC
char type[3];
char remote[20];
char *target, *user, *password;

MYSQL mysql;
MYSQL_RES *result;
MYSQL_ROW row;

void device_choice1(MYSQL *, char [], char []);
void TVcontrol(char []);
/*void CDcontrol(char []);
void VCDcontrol(char []);
void DVDcontrol(char []);
void MP3control(char []);*/

void parsearguments1()
{
	strcpy (device, "/dev/null");
	baudrate = 115200;
	errorsleeptime = 10;
	rtscts = 0;
	strcpy (modemname, device);
	}

void parsearguments ()
{
	strcpy (device, "/dev/rfcomm0");
	baudrate = 115200;
	errorsleeptime = 10;
	rtscts = 0;
	strcpy (modemname, device);
	}

void flush (char *fl,int len)
{
	int m;
	for (m=0;m<len;m++)
	{
		fl[m]='\0';
	}
}

int main (int argc, char **argv)
{
	int submenu_selected;
	int func1_selected;
	int func2_selected;
	int func3_selected;
	int func4_selected;
	int func5_selected;
	int func6_selected;
	int which_submenu;
	int type_choice1=0;
	target=user=password=NULL;
	parsearguments ();
	snprintf (tmp, sizeof (tmp), "t68_remote_v2 (%s)", modemname);
	tmp[sizeof (tmp) - 1] = 0;
	openlogfile (tmp, logfile, LOG_DAEMON, loglevel);
	set_alarmhandler (alarmhandler, alarmlevel, modemname);
	printf("\E[H\E[J"); 
	printf ("Bluetooth infrared converter\n\n");
	printf ("Doing initializations !\n");
	mysql_init(&mysql);
	if (!mysql_connect(&mysql, target, user, password)) 
	{
       	printf("Database connection failed\n");
       	return 0;
   		}
	else 
		printf("Database connection ok\n");  
	mysql_select_db(&mysql,"AVDevice");
	openmodem ();
	setmodemparams ();
	sprintf (command, "at+cscs=i\"8859-1\"\r");
	ret_code = put_command (command, answer, sizeof (answer), 5, 0);
	sprintf (command, "AT*EAM=\"Bt-IrConverter\"\r");
	ret_code = put_command (command, answer, sizeof (answer), 5, 0);
	while (1)
	{
		submenu_selected = 0;
		while (!submenu_selected)
		{
			ret_code = put_command ("", answer, sizeof (answer), 5, 0);
			submenu_selected = (NULL != strstr (answer, "*EAAI"));
			}
		while (1)
		{
			sprintf (command, "AT*EASM=\"Bt-IrConverter\",1,1,6,\"TV\",\"CD\",\"VCD\",\"DVD\",\"MP3\",\"quit\",\r");
			ret_code = put_command (command, answer, sizeof (answer), 6, 0);
	    	func1_selected = 0;
	      	func2_selected = 0;
	      	func3_selected = 0;
	      	func4_selected = 0;
			func5_selected = 0;
			func6_selected = 0;
	      	while (!func1_selected && !func2_selected && !func3_selected && !func4_selected && !func5_selected && !func6_selected)
			{
				ret_code = put_command ("", answer, sizeof (answer), 6, 0);
				func1_selected = (NULL != strstr (answer, "*EAMI: 1"));
				func2_selected = (NULL != strstr (answer, "*EAMI: 2"));
				func3_selected = (NULL != strstr (answer, "*EAMI: 3"));
				func4_selected = (NULL != strstr (answer, "*EAMI: 4"));
				func5_selected = (NULL != strstr (answer, "*EAMI: 5"));
				func6_selected = (NULL != strstr (answer, "*EAMI: 6"));
				}
	      	if (func6_selected)
				break;
	      	else if (func1_selected)
			{
				which_submenu = 1;
				printf("Mobile user selected TV\n"); 
				}
	      	else if (func2_selected)
			{
				which_submenu = 2;
				printf("Mobile user selected CD\n"); 
				}
	      	else if (func3_selected)
			{
				which_submenu = 3;
				printf("Mobile user selected VCD\n");
				}
			else if (func4_selected)
			{
				which_submenu = 4;
				printf("Mobile user selected DVD\n");
				}
			else if (func5_selected)
			{
				which_submenu = 5;
				printf("Mobile user selected MP3\n");
				}
		   	switch (which_submenu)
			{
				case 1:
					device_choice1(&mysql, "TV", remote);
					TVcontrol(remote);
					break;
				case 2:	
					device_choice1(&mysql, "CD", remote);
					//CDcontrol(remote);
					break;
				case 3:
					device_choice1(&mysql, "VCD", remote);
					//VCDcontrol(remote);
					break;
				case 4:
					device_choice1(&mysql, "DVD", remote);
					//DVDcontrol(remote);
					break;
				case 5:
					device_choice1(&mysql, "MP3", remote);
					//MP3control(remote);
					break;
				default:
					break;
					}
				}
		mysql_close(&mysql);
		printf ("Mobile user has quitted!\n");
	    exit(0); 
		sprintf(command, "AT+CMER=0,0,0,0,0\r");
		ret_code = put_command (command, answer, sizeof (answer), 5, 0);   
		}
	}

void device_choice1(MYSQL *mysql, char type[], char remote[])
{
	char query_buffer[1000];
	char buffer[1024];
	char device[100][20];
	char model[100][20];
	int item_brand;
	int item_model;
	int brand_selected=0;
    int model_selected=0;
	int db_success;
	int ans_selected[100];
	int a,b,c,i,j,k,l;
	int count1;
	int count2;
    repeat1:
    item_brand=0;
    item_model=0;
    sprintf(query_buffer, "SELECT distinct(Brand) from %s ORDER by Brand", type);
	if (mysql_query(mysql, query_buffer)==0)
	{
		db_success=1;
		result=mysql_use_result(mysql);
		while (row = mysql_fetch_row(result))
		{
			item_brand++;
            strcpy(device[item_brand-1], row[0]);
			}
      	mysql_free_result(result); 
		}
	else
	{
		printf("There is an error when showing result! \n");
		db_success=0;
		}
	if (db_success==1)
	{
	    for (i=0; i<item_brand; i++)
			printf("%d. %s \n", i+1, device[i]);
		sprintf(command, "AT*EASM=\"Bt-IrConverter\",1,1,%d", item_brand+1);
		ret_code=put_command (command, answer, sizeof (answer), 5, 0);
		for (j=0; j<item_brand; j++)
		{
			sprintf(command, ",\"%s\"", device[j]);
			ret_code=put_command (command, answer, sizeof (answer), 5, 0);
			}
		sprintf(command, ",\"quit\",\r");
		ret_code=put_command (command, answer, sizeof (answer), 5, 0);
		for (k=0; k<item_brand+1; k++)
			ans_selected[k]=0;
		count1=1;
		while (count1)
		{
			ret_code = put_command ("", answer, sizeof (answer), 5, 0);
			for (l=0; l<item_brand+1; l++)
			{
				sprintf (buffer, "*EAMI: %d", l+1);
				ans_selected[l] = (NULL != strstr (answer, buffer));
				if (ans_selected[l]==1)
				{
					count1=0;
					brand_selected=l;
					break;
					}
				}
			}
	    if (ans_selected[item_brand])
			goto repeat1;
		else 
        {
			printf("You have chosen %s %s \n", device[brand_selected], type);
			sprintf(query_buffer, "SELECT Model from %s WHERE Brand='%s' ORDER by Model", type, device[brand_selected]);
			if (mysql_query(mysql, query_buffer)==0)
			{
				db_success=1;
				result=mysql_use_result(mysql);
				while (row = mysql_fetch_row(result))
				{
					item_model++;
					strcpy(model[item_model-1], row[0]);
					}
      				mysql_free_result(result); 
				}
			else 
			{
				printf("There is an error when showing result! \n");
				db_success=0;
				}
			if (db_success==1)
			{
				sprintf(command, "AT*EASM=\"Bt-IrConverter\",1,1,%d", item_model+1);
				ret_code=put_command (command, answer, sizeof (answer), 5, 0);
				for (a=0; a<item_model; a++)
				{
					sprintf(command, ",\"%s\"", model[a]);
					ret_code=put_command (command, answer, sizeof (answer), 5, 0);
					}
				sprintf(command, ",\"quit\",\r");
				ret_code=put_command (command, answer, sizeof (answer), 5, 0);
				for (b=0; b<item_model+1; b++)
					ans_selected[b]=0;
				count2=1;
				while (count2)
				{
					ret_code = put_command ("", answer, sizeof (answer), 5, 0);
					for (c=0; c<item_model+1; c++)
					{
						sprintf (buffer, "*EAMI: %d", c+1);
						ans_selected[c] = (NULL != strstr (answer, buffer));
						if (ans_selected[c]==1)
						{
							count2=0;
							model_selected=c;
							break;
							}
						}
					}
				if (ans_selected[item_model])
					goto repeat1;
				else
				{
					strcpy(remote, model[model_selected]);
					printf("You have chosen %s %s %s \n", device[brand_selected],  remote, type);
				}
			}
		}
	}
}

void TVcontrol(char remote[])
{
	char instruct[1024];
	int item_choice1=0;
	int ans_select[100];
	int con;
	int channel1;
	int channel2;
	int a,b,c,d,e,f,g,h,i;
	int choice1;
	int choice2;
	int menu_count;
	int channel_count=0;
	TV:
	sprintf (command, "AT*EASM=\"TV\",1,1,7,\"Power\",\"Channel\",\"Volume\",\"Menu\",\"Language\",\"Others\",\"quit\",\r");
	ret_code = put_command (command, answer, sizeof (answer), 5, 0);
	for (a=0; a<7; a++)
		ans_select[a]=0;
	choice1=1;
	while (choice1)
	{
		ret_code=put_command ("", answer, sizeof (answer), 5, 0);
		for (b=0; b<7; b++)
		{
			sprintf (buffer, "*EAMI: %d", b+1);
			ans_select[b] = (NULL != strstr (answer, buffer));
			if (ans_select[b]==1)
			{
				choice1=0;
				con=b+1;
				break;
				}
			}
		}
	if (ans_select[6])
		return;
	else
	{
		switch (con)
		{
			case 1:
				sprintf(instruct, "/usr/local/irtrans/irclient localhost %s power", remote);
				system(instruct);
				printf("The user has turn on/off the TV \n");
				break;
			case 2:
				channel:
				sprintf (command, "AT*EASM=\"Channel\",1,1,3,\"0-9?\",\"10 or above?\",\"quit\",\r");
				ret_code = put_command (command, answer, sizeof (answer), 5, 0);
				for (c=0; c<3; c++)
					ans_select[c]=0;
				while (!ans_select[0] && !ans_select[1] && !ans_select[2])
				{
					ret_code = put_command ("", answer, sizeof (answer), 5, 0);
					ans_select[0]=(NULL!=strstr(answer, "*EAMI: 1"));
					ans_select[1]=(NULL!=strstr(answer, "*EAMI: 2"));
					ans_select[2]=(NULL!=strstr(answer, "*EAMI: 3"));
					}
				if (ans_select[2])
					break;
				else if (ans_select[0])
				{
					sprintf (command, "AT*EASM=\"channel\",1,1,11,\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"quit\",\r");
					ret_code = put_command (command, answer, sizeof (answer), 5, 0);
					for (d=0; d<11; d++)
						ans_select[d]=0;
					choice1=1;
					while (choice1)
					{
						ret_code=put_command ("", answer, sizeof (answer), 5, 0);
						for (e=0; e<11; e++)
						{
							sprintf (buffer, "*EAMI: %d", e+1);
							ans_select[e] = (NULL != strstr (answer, buffer));
							if (ans_select[e]==1)
							{
								choice1=0;
								channel1=e;
								break;
								}
							}
						}
					if (ans_select[10])
						goto channel;
					else
					{
						sprintf(instruct, "/usr/local/irtrans/irclient localhost %s %d", remote, channel1);
						system(instruct);
						printf("Mobile user selected channel %d\n", channel1);
						goto TV;
						}
					}
				else if (ans_select[1])
				{
					sprintf (command, "AT*EASM=\"channel_tens?\",1,1,10,\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"quit\",\r");
					ret_code = put_command (command, answer, sizeof (answer), 5, 0);
					for (f=0; f<10; f++)
						ans_select[f]=0;
					choice1=1;
					while (choice1)
					{
						ret_code=put_command ("", answer, sizeof (answer), 5, 0);
						for (g=0; g<10; g++)
						{
							sprintf (buffer, "*EAMI: %d", g+1);
							ans_select[g] = (NULL != strstr (answer, buffer));
							if (ans_select[g]==1)
							{
								choice1=0;
								channel1=g;
								break;
								}
							}
						}
					if (ans_select[9])
						goto channel;
					else
					{
						sprintf (command, "AT*EASM=\"channel_ones?\",1,1,11,\"0\",\"1\",\"2\",\"3\",\"4\",\"5\",\"6\",\"7\",\"8\",\"9\",\"quit\",\r");
						ret_code=put_command (command, answer, sizeof (answer), 5, 0);
						for (h=0; h<11; h++)
						ans_select[h]=0;
						choice2=1;
						while (choice2)
						{
							ret_code=put_command ("", answer, sizeof (answer), 5, 0);
							for (i=0; i<11; i++)
							{
								sprintf (buffer, "*EAMI: %d", i+1);
								ans_select[i] = (NULL != strstr (answer, buffer));
								if (ans_select[i]==1)
								{
									choice2=0;
									channel2=i;
									}
								}
							}
						if (ans_select[10])
							goto channel;
						else
						{
							sprintf(instruct, "/usr/local/irtrans/irclient localhost %s 10+", remote);
							system(instruct);
							sprintf(instruct, "/usr/local/irtrans/irclient localhost %s %d", remote, channel1);
							system(instruct);
							sprintf(instruct, "/usr/local/irtrans/irclient localhost %s %d", remote, channel2);
							system(instruct);
							printf("Mobile user selected channel %d\n", channel1*10+channel2);
							channel_count++;
							if (channel_count==2)
							{
								sprintf(instruct, "/usr/local/irtrans/irclient localhost %s 10+", remote);
								system(instruct);
								channel_count=0;
								}
							goto TV;
							}
						}
				}
				break;
			case 3:
				vol:
				sprintf (command, "AT*EASM=\"Volume\",1,1,3,\"increase vol?\",\"decrease vol?\",\"quit\",\r");
				ret_code = put_command (command, answer, sizeof (answer), 5, 0);
				for (c=0; c<3; c++)
					ans_select[c]=0;
				while (!ans_select[0] && !ans_select[1] && !ans_select[2])
				{
					ret_code = put_command ("", answer, sizeof (answer), 5, 0);
					ans_select[0]=(NULL!=strstr(answer, "*EAMI: 1"));
					ans_select[1]=(NULL!=strstr(answer, "*EAMI: 2"));
					ans_select[2]=(NULL!=strstr(answer, "*EAMI: 3"));
					}
				if (ans_select[2])
					break;
				else
                {
					if (ans_select[0])
					{
						sprintf(instruct, "/usr/local/irtrans/irclient localhost %s upvol", remote);
						system(instruct);
						printf("Mobile user selected to increase volume\n");
						}
					else if (ans_select[1])
					{
						sprintf(instruct, "/usr/local/irtrans/irclient localhost %s downvol", remote);
						system(instruct);
						printf("Mobile user selected to decrease volume\n");
						}
                    goto vol;
					}
				break;
			case 4:
				menu_count=0;
				sprintf(instruct, "/usr/local/irtrans/irclient localhost %s menu", remote);
				system(instruct);
				printf("Mobile user entered to menu\n");
				menu:
				sprintf(command, "AT*EASM=\"Menu\",1,1,6,\"up\",\"down\",\"left\",\"right\",\"Menu\",\"quit\",\r");
				ret_code = put_command (command, answer, sizeof (answer), 5, 0);
				for (d=0; d<6; d++)
					ans_select[d]=0;
				choice1=1;
				while (choice1)
				{
					ret_code=put_command ("", answer, sizeof (answer), 5, 0);
					for (e=0; e<6; e++)
					{
						sprintf (buffer, "*EAMI: %d", e+1);
						ans_select[e]=(NULL != strstr (answer, buffer));
						if (ans_select[e]==1)
						{
							choice1=0;
							break;
							}
						}
					}
				if (ans_select[5])
					break;
				else
				{
					if (ans_select[0])
					{
						sprintf(instruct, "/usr/local/irtrans/irclient localhost %s upchannel", remote);
						system(instruct);
						goto menu;
						}
					else if (ans_select[1])
					{
						sprintf(instruct, "/usr/local/irtrans/irclient localhost %s downchannel", remote);
						system(instruct);
						goto menu;
						}
					else if (ans_select[2])
					{
						sprintf(instruct, "/usr/local/irtrans/irclient localhost %s downvol", remote);
						system(instruct);
						goto menu;
						}
					else if (ans_select[3])
					{
						sprintf(instruct, "/usr/local/irtrans/irclient localhost %s upvol", remote);
						system(instruct);
						goto menu;
						}
					else if (ans_select[4])
					{
						sprintf(instruct, "/usr/local/irtrans/irclient localhost %s menu", remote);
						system(instruct);
						printf("Mobile user selected an item\n");
						menu_count++;
						if (menu_count==1)
							goto menu;
						else 
							goto TV;
						}
					}
				break;
			case 5:
				sprintf(instruct, "/usr/local/irtrans/irclient localhost %s lang", remote);
				system(instruct);
				printf("Mobile user selected to change language\n");
			case 6:
				Other:
				sprintf (command, "AT*EASM=\"Others\",1,1,4,\"Mode\",\"Silent\",\"Call\",\"quit\",\r");
				ret_code = put_command (command, answer, sizeof (answer), 5, 0);
				for (f=0; f<4; f++)
					ans_select[f]=0;
				while (!ans_select[0] && !ans_select[1] && !ans_select[2] && !ans_select[3])
				{
					ret_code = put_command ("", answer, sizeof (answer), 5, 0);
					ans_select[0]=(NULL!=strstr(answer, "*EAMI: 1"));
					ans_select[1]=(NULL!=strstr(answer, "*EAMI: 2"));
					ans_select[2]=(NULL!=strstr(answer, "*EAMI: 3"));
					ans_select[3]=(NULL!=strstr(answer, "*EAMI: 4"));
					}
				if (ans_select[3])
					break;
	      		else if (ans_select[0])
				{
					sprintf(instruct, "/usr/local/irtrans/irclient localhost %s mode", remote);
					system(instruct);
					printf("Mobile user selected to change display mode\n");
					goto Other;
					}
				else if (ans_select[1])
				{
					sprintf(instruct, "/usr/local/irtrans/irclient localhost %s silent", remote);
					system(instruct);
					printf("Mobile user selected to let the TV silent\n");
					goto Other;
					}
				else if (ans_select[2])
				{
					sprintf(instruct, "/usr/local/irtrans/irclient localhost %s call", remote);
					system(instruct);
					printf("Mobile user selected to call something\n");
					goto Other;
					}
				break;
			default:
				break;
			}
		goto TV;
		}
	}

[-- Attachment #3: create_AVDevice.sql --]
[-- Type: application/octet-stream, Size: 213 bytes --]

CREATE TABLE TV (
Brand char(20),
Model char (20));

CREATE TABLE CD (
Brand char(20),
Model char (20));

CREATE TABLE VCD (
Brand char(20),
Model char (20));

CREATE TABLE DVD (
Brand char(20),
Model char (20));

[-- Attachment #4: insert_AVDevice.sql --]
[-- Type: application/octet-stream, Size: 1401 bytes --]

INSERT INTO TV VALUES ('AIWA','SB201');
INSERT INTO TV VALUES ('AIWA','A201');
INSERT INTO TV VALUES ('Hitachi','55PD5000TA');
INSERT INTO TV VALUES ('Hitachi','32PD5000TA');
INSERT INTO TV VALUES ('JVC','HV-Z29J4H');
INSERT INTO TV VALUES ('JVC','AV-25VS14');
INSERT INTO TV VALUES ('Sharp','25C-FG8');
INSERT INTO TV VALUES ('Sharp','29D-FG8');
INSERT INTO TV VALUES ('Toshiba','29JZ6SH');
INSERT INTO TV VALUES ('Toshiba','29A3SH');
INSERT INTO TV VALUES ('Toshiba','25SF6LH');
INSERT INTO TV VALUES ('Panasonic','TC-26LX1');
INSERT INTO TV VALUES ('Panasonic','TC-20LA1');

INSERT INTO CD VALUES ('Panasonic','DMR-E500H');
INSERT INTO CD VALUES ('Panasonic','DMR-E100H');
INSERT INTO CD VALUES ('JVC','UX-Q1S');
INSERT INTO CD VALUES ('JVC','UX-QD7M');
INSERT INTO CD VALUES ('Sharp','SD-AT50W');
INSERT INTO CD VALUES ('Jyoto','KDH-601');

INSERT INTO VCD VALUES ('Panasonic','DMR-E500H');
INSERT INTO VCD VALUES ('Panasonic','DMR-E100H');
INSERT INTO VCD VALUES ('JVC','TH-S9');
INSERT INTO VCD VALUES ('JVC','TH-S7 ');
INSERT INTO VCD VALUES ('Toshiba','SD-2960SA');
INSERT INTO VCD VALUES ('Toshiba','SD-K380SA');

INSERT INTO DVD VALUES ('Panasonic','DMR-E500H');
INSERT INTO DVD VALUES ('Panasonic','DMR-E100H');
INSERT INTO DVD VALUES ('JVC','TH-S9');
INSERT INTO DVD VALUES ('JVC','TH-S7 ');
INSERT INTO DVD VALUES ('Toshiba','SD-2960SA');
INSERT INTO DVD VALUES ('Toshiba','SD-K380SA');


  reply	other threads:[~2005-02-19 13:45 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-28 14:06 [Bluez-users] rfcomm question 1 Ka Kin Cheung
2005-01-28 17:36 ` Marcel Holtmann
2005-01-29  5:32   ` Ka Kin Cheung
2005-01-29 14:03     ` Marcel Holtmann
2005-01-31 13:41       ` Ka Kin Cheung
2005-01-31 14:22         ` Marcel Holtmann
2005-01-31 14:30           ` Ka Kin Cheung
2005-01-31 14:38             ` Marcel Holtmann
2005-02-01  6:25               ` [Bluez-users] rfcomm question 3 Ka Kin Cheung
2005-02-01  8:14                 ` Marcel Holtmann
2005-02-01 14:39                   ` Ka Kin Cheung
2005-02-02  2:49                   ` Ka Kin Cheung
2005-02-02  3:10                     ` Marcel Holtmann
2005-02-02  4:54                       ` Ka Kin Cheung
2005-02-02  5:34                         ` Marcel Holtmann
2005-02-03  3:42                           ` Ka Kin Cheung
2005-02-03  5:22                             ` Alain Volmat
2005-02-03 10:50                               ` Ka Kin Cheung
2005-02-03 10:59                                 ` Alain Volmat
2005-02-03 13:01                                   ` Ka Kin Cheung
2005-02-03 13:20                                     ` Marcel Holtmann
2005-02-03 14:26                                       ` Ka Kin Cheung
2005-02-03 14:54                                         ` Marcel Holtmann
2005-02-04 16:56                                     ` Marco Trudel
2005-02-05 12:48                                       ` Ka Kin Cheung
2005-02-05 13:17                                         ` Marco Trudel
2005-02-05 13:51                                           ` Marcel Holtmann
2005-02-05 14:00                                             ` Marco Trudel
2005-02-05 14:14                                               ` Marcel Holtmann
2005-02-05 17:39                                                 ` Marco Trudel
2005-02-05 18:08                                                   ` Marcel Holtmann
2005-02-17  5:37                                                     ` Ka Kin Cheung
2005-02-17  6:28                                                       ` Alain Volmat
2005-02-17  9:08                                                       ` mike
2005-02-17 13:08                                                       ` Marco Trudel
2005-02-17 13:54                                                         ` Ka Kin Cheung
2005-02-17 14:10                                                           ` Marco Trudel
2005-02-17 14:43                                                             ` Ka Kin Cheung
2005-02-17 17:04                                                               ` Marco Trudel
2005-02-18  3:28                                                                 ` Ka Kin Cheung
2005-02-19  6:49                                                                   ` Marco Trudel
2005-02-19  8:27                                                                     ` Ka Kin Cheung
2005-02-19 10:06                                                                       ` Marco Trudel
2005-02-19 13:45                                                                         ` Ka Kin Cheung [this message]
2005-02-18  3:33                                                                 ` Ka Kin Cheung
2005-02-18  7:51                                                                   ` [Bluez-users] multiple instances of OPUSH server Janice M. Ballesteros
2005-02-17 13:14                                                       ` [Bluez-users] rfcomm question 3 Marco Trudel
2005-02-02  3:16                     ` Alain Volmat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050219134536.65862.qmail@web60905.mail.yahoo.com \
    --to=michaelhku2002@yahoo.com.hk \
    --cc=bluez-users@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox