09.07.2015 Views

VideoSMS/Client Application Programming Interface ... - MCTel

VideoSMS/Client Application Programming Interface ... - MCTel

VideoSMS/Client Application Programming Interface ... - MCTel

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

ExamplesExample 9–2 (Cont.)C SMS Send sample progralsmsRet Res;smsConnID ConnId;smsUInt32 NbCredits;SMSMessage Message;char PrivateReference[SMS_SEND_PRIVATE_REF_MAX_LEN]="My ref";char PrivateData[SMS_SEND_PRIVATE_DATA_MAX_LEN]="xxx";/* Connection to MCTEL SMS Gateway */Res = SMS_ConnectGateway( &ConnId, GATEWAY_ADDRESS, strlen(GATEWAY_ADDRESS),GATEWAY_PORT );if(Res!=SMSNormal) {printf("Connection error to MCTEL SMS Gateway.\n");return Res;}/* Identification */Res = SMS_LoginGateway( *ConnId, COMPANYID, COMPANYPWD, USERID, USERPWD,"MONAPP", 0, &NbCredits );if ( Res != SMSNormal ) {SMS_LogoutGateway( *ConnId );printf("Authentication failure.\n");return Res;}/*Fill in HERE the ’Message’ structure*/memset(&Message, 0, sizeof(Message));strcpy(Message.called_number, "+336xxxx");strcpy(Message.caller_number, "+336xxxx");strcpy(Message.msg_data, "This is my test message from linux.");Message.msg_length = (smsUInt32) strlen(Message.msg_data);Message.msg_class = 1;//Initialize send options://(SMSOpt_Deferred, SMSOpt_EmailAlert, SMSOpt_EmailConfirm, SMSOpt_Flash,//SMSOpt_Confidential)Message.msg_options = SMSSendOpt_None;//Initialize deferred date if "SMSOpt_Deferred" is set in "msg_options"//elsewise put 0Message.deferred_date = 0;/* Send the SMS */Res = SMS_Send(ConnId, &Message, PrivateReference, PrivateData);if(Res!=SMSNormal) {printf("Error sending SMS to MCTEL gateway.\n");return;}printf("Message sent.\n");/* Disconnect */SMS_LogoutGateway( ConnId );SMS_DisconnectGateway( ConnId );}9–9

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!