Package ru.headhunter.smsengine.client

Examples of ru.headhunter.smsengine.client.SmsMessage


            engine.openPort();
        } catch (Exception e) {
            return;
        }

        SmsMessage sms = new SmsMessage();
        sms.setUid(36L);
        engine.deleteMessageFromStorage(sms);

        for (SmsMessage smsMessage : engine.getIncomingMessages()) {
            System.out.println("uid: [" + smsMessage.getUid() + "], receivedTime: [" + smsMessage.getReceiveTime() + "], number: [" + smsMessage.getFromPhone() + "], message: [" + smsMessage.getMessageBody() + "]");
        }
View Full Code Here


public class DecodePduTest extends TestCase {

    public void testPduGSM() throws Exception {
        String pdu = "07919730071111F1240B919750633702F50000607071011385000CD4F29C0E6A97E7F3F0B90C";
        SmsMessage smsMessage = SMSTools.decodePdu(pdu);
        System.out.println("Message from [" + smsMessage.getFromPhone() + "], text: [" + smsMessage.getMessageBody() + "]");
        assertEquals("79053673205", smsMessage.getFromPhone());
        assertEquals("Test message", smsMessage.getMessageBody());
    }
View Full Code Here

        assertEquals("Test message", smsMessage.getMessageBody());
    }
   
    public void testPduUSC2() throws Exception {
        String pdu = "07919730071111F1240B919750633702F50008607071213085002204220435044104420020043D04300020043A043804400438043B043B043804460435";
        SmsMessage smsMessage = SMSTools.decodePdu(pdu);
        System.out.println("Message from [" + smsMessage.getFromPhone() + "], text: [" + smsMessage.getMessageBody() + "]");
        assertEquals("79053673205", smsMessage.getFromPhone());
        assertEquals("Тест на кириллице", smsMessage.getMessageBody());
    }
View Full Code Here

        assertEquals("Тест на кириллице", smsMessage.getMessageBody());
    }
   
    public void testAlphanumericSenderNumber() throws Exception {
        String pdu = "07919720730005F82010D0D0B25B1F6E1DA74D0008509080328054217A041204300448002004310430043B0430043D0441002000380035002E003200370020042004430431002E0020041F043E04360430043B04430439044104420430002C0020043F043E043F043E043B043D043804420435002004310430043B0430043D0441002E0020041F0435043D04370430002D00470053004D";
        SmsMessage smsMessage = SMSTools.decodePdu(pdu);
        System.out.println("Message from [" + smsMessage.getFromPhone() + "], text: [" + smsMessage.getMessageBody() + "]");
        assertEquals("Penza-GSM", smsMessage.getFromPhone());
        assertEquals("Ваш баланс 85.27 Руб. Пожалуйста, пополните баланс. Пенза-GSM", smsMessage.getMessageBody());
    }
View Full Code Here

            }
            data = expand(sms);
        }

        //----- put all informations together
        SmsMessage smsMessage = new SmsMessage();
        smsMessage.setFromPhone(orgnumber);
        smsMessage.setMessageBody(data);
        smsMessage.setReceiveTime(dateTime);
//        data = orgnumber + " " + date + " " + time + " +" + timezone + " " + ">" + data;
        return smsMessage;
    }
View Full Code Here

        List<SmsMessage> result = new LinkedList<SmsMessage>();
        boolean nextLineIsPdu = false;
        Long nextLineSmsIndex = null;
        for (String line : reply.split("\n")) {
            if (nextLineIsPdu) {
                SmsMessage smsMessage = SMSTools.decodePdu(line);
                smsMessage.setUid((Long)nextLineSmsIndex);
                result.add(smsMessage);
               
                nextLineIsPdu = false;
                nextLineSmsIndex = null;
                continue;
View Full Code Here

TOP

Related Classes of ru.headhunter.smsengine.client.SmsMessage

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.