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/
Diff: AdmAuthentication.h
- Revision:
- 0:40a09c55e5be
diff -r 000000000000 -r 40a09c55e5be AdmAuthentication.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/AdmAuthentication.h Sat Nov 07 12:21:19 2015 +0000 @@ -0,0 +1,41 @@ +//////////////////////////////////////////////////////////////////////////// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Portions Copyright (c) Kentaro Sekimoto All rights reserved. +// +// Based on Text-To-Speech for .NET Micro Framework with Microsoft +// Translator Service +// https://code.msdn.microsoft.com/Text-To-Speech-for-NET-9cea4462 +// +//////////////////////////////////////////////////////////////////////////// + +#include "mbed.h" + +class AdmAuthentication +{ +public: + AdmAuthentication(char *clientID, char *clientSecret); + ~AdmAuthentication(); + char *GetAccessToken(); + char *HttpPost(char *DatamarketAccessUri, char *requestDetails); + +private: + char *id; + char *secret; + char encoded_id[64]; + char encoded_secret[64]; + char request[256]; + char token[1024]; + char url[128]; +}; \ No newline at end of file