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/

/media/uploads/ksekimoto/gr-peach_cloud_speech_01.jpg

AdmAuthentication.h

Committer:
ksekimoto
Date:
2015-11-07
Revision:
0:40a09c55e5be

File content as of revision 0:40a09c55e5be:

////////////////////////////////////////////////////////////////////////////
//  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];
};