To call Azure Marketplace Translation (and Speech) service
Dependencies: EthernetInterface-FRDM HTTPClient-SSL R_BSP SDFileSystem TLV320_RBSP USBHost mbed-rtos mbed-src
The program calls Azure Marketplace Translation (and Speech) service.
How to use - Create an account for Microsoft Azure Marketplace - Get client ID and client secret. - Change client ID and client secret in main.cpp
The program was created based on the following libraries.
CodePlex Text-To-Speech with Microsoft Translator Service http://translatorservice.codeplex.com/
MBED HTTPClient-SSL Library https://developer.mbed.org/teams/MultiTech/code/HTTPClient-SSL/
getline.cpp
- Committer:
- ksekimoto
- Date:
- 2015-11-07
- Revision:
- 1:a2bd45c3b373
- Parent:
- 0:40a09c55e5be
File content as of revision 1:a2bd45c3b373:
#include <mbed.h>
int getline(char *prompt, char *buff, int size)
{
int sz ;
printf("%s", prompt) ;
for(sz = 0 ; (sz < size) && ((*buff = getchar()) != '\r'); sz++, buff++) {
putchar(*buff) ;
if(*buff == '\\') {
if(++sz >= size)break ;
*buff = getchar() ;
putchar(*buff) ;
switch(*buff) {
case 'n' :
*buff = '\n' ;
break ;
case 'r' :
*buff = '\r' ;
break ;
case 't' :
*buff = '\t' ;
break ;
case '\\':
*buff = '\\' ;
break ;
default:
buff[1] = buff[0] ;
buff[0] = '\\' ;
buff++ ;
}
} else if(*buff == '\b') {
if(sz >= 2) {
buff-=2 ;
sz-=2;
}
}
} ;
putchar('\n') ;
*buff = '\0' ;
return sz ;
}