SMS listening by using Cascades SmsTransport

I'm having some trouble with the SmsTransport api. The listeners for phone and email are simple and work great, but when I try and listen for sms I get this runtime warning:

Warning: Object::connect: No such signal bb::pim::message::SmsTransport::messageReceived(unsigned int, const
bb::pim::message::Message&) in ../src/App.cpp:58

and this is the code that is the problem:

     mSmsTransport->registerPort(0);
     connect(mSmsTransport, SIGNAL(messageReceived(unsigned int, const bb::pim::message::Message&)), SLOT(handleSms(unsigned int, const bb::pim::message::Message&)));

Maybe the method signature has changed from what is listed here?
https://developer.blackberry.com/cascades/reference/bb__pim__message__smstransport.html

Also related to this.. is 0 the correct port to register on to listen for SMS's? It worked this way on Java BB but I'm not sure about BB10.

Patch the SDK to C:\devel\bbndk\target_10_0_9_2318\qnx6\usr\include\bb\pim\message\MessageUpdate.hpp and adding the line to the bottom of the file solves the problem. Not sure how it works for you, unless you have this line.

Q_DECLARE_METATYPE (bb:im::message:MessageUpdate)

Tags: BlackBerry Developers

Similar Questions

  • How to test the SMS listener using 2 emulators in SDK5 running Windows 7

    Hi all. Writing a SMS listener I want to test. But can someone please pass me how I can configure the SDK BB 5 (not the Eclipse plugin) running on Windows 7, so that I can send a test SMS from an emulator to another to see what is happening in the debugger. Thank you so much as always.

    Found answer in another post from Kanaksony. His response has been to make the source and destination for even 1 emulator ports. His post was:

    You need to sms-source port and sms-destination ports even in Simulator. Go to JDE-> Edit-> preferences-> tab-> port sms-source Simulator: 21316 and port destination sms: 21316

  • SMS listener

    Hi - just wondering if he had plans to make available a way to implement a SMS listener for incoming SMS messages / outgoing (this was possible on the old Java SDK). I don't see anything equivalent in the latest SDKS, neither on the road map.

    Thanks in advance :-)

    Hello

    in fact, we already support something very similar to the listeners of the Java platform.

    SMS is part of the PIM API and the key classes

    bb::pim::message::SmsTransport.
    

    This class allows (among other things) registration for incoming SMS messages addressed to a specific port. You will receive SMS messages to port and be able to extract their payload as a byte array. The class uses Qt signals and slots, so it is quite easy to use. Here are a few snippets of code to help you get started:

    in the header

    public slots:
    void onMessageReceived(unsigned int, const Message &);
    void onRegisterResultReceived(unsigned int port, bb::pim::message::SmsTransportRegistrationResult::Type status );
    
    private:
    bb::pim::message::SmsTransport* _sms_transport;
    

    in the source of the CPP, my class called SmsReceiver:

    SmsReceiver::SmsReceiver(bb::cascades::Application *app) :
       QObject(app), _initialised_ok(false), _sms_transport(new bb::pim::message::SmsTransport(this)) {
    
        connect(_sms_transport, SIGNAL(registerResultReceived (unsigned int,
                        bb::pim::message::SmsTransportRegistrationResult::Type)), this,
                       SLOT(onRegisterResultReceived(unsigned int,
                                                                       bb::pim::message::SmsTransportRegistrationResult::Type)));
    
        connect(_sms_transport, SIGNAL(messageReceived (unsigned int, const Message &)), this,
                       SLOT(onMessageReceived(unsigned int, const Message &)));
    
        // registering to receive SMS messages addressed to port 16000
        _sms_transport->registerPort(16000);
    }
    
    void SmsReceiver::onRegisterResultReceived(unsigned int port, bb::pim::message::SmsTransportRegistrationResult::Type status) {
    
        if (status == 1) {
            log(QString("Port %1 registered OK").arg(port));
        } else {
            log("Failed to register port:" + status);
            log("Error:" + getResultReceivedName(status));
        }
    
    }
    
    void SmsReceiver::onMessageReceived(unsigned int port, const Message& message) {
    
      // the short_message payload is an Attachment to the PIM Message object and the .data() method returns it as a byte array
        bb::pim::message::Attachment attachment = message.attachmentAt(0);
        hexlog(attachment.data());
    
    }
    

    Key points:

    • registration will succeed or fail, and you must use the registerResultReceived signal to receive the notification of the result of this step.
    • When a message to your registered port is received by the operating system, a signal messageReceived sounds then you must connect one of your methods of this signal. Your slot will receive a Message object. The attribute short_message of the SMS ("short_message" by GSM 03.40) will be given an object attachment associated with the subject of the Message. Retrieves the attachment object and call the data() function to get short_message as a byte array. Note that to properly decode the array of bytes that you really know his what data_coding value has been used when you create and send the SMS message and whether or not a header (UDH) user data is present.

    I hope this helps.

    Martin

  • -Contact SMS listener?

    Hi all

    I put in place of the SMS listener and I am able to get the device number but I'm not able to get the name of the contact to shippers. Any one know how to get contact name of entrants and SMS-password.

    Thank you

    got the solution here:- recover contacts by phone number

  • SMS for outgoing SMS listener throws IOException immediately after the open call

    I had already created a class for sending SMS messages which worked perfectly until I added the listener. When the listener is added as soon as I start the thread throws an IOException exception who am I hurting? The only thing I can think is some kind of wire problem, please help.

    Here's the SMS & Listener class:

    private static final class SmsMessage    {        private String _address;        private String _msg;
    
            public SmsMessage(String address, String msg)        {            _address = address;            _msg = msg;        }
    
            public Message toMessage(MessageConnection mc)        {            TextMessage m = (TextMessage)mc.newMessage(MessageConnection.TEXT_MESSAGE,"sms://" + _address);            m.setPayloadText(_msg);            return m;        }    } // SmsMessage
    
       private final class SendThread extends Thread    {        private static final int TIMEOUT = 500; // ms        private Vector _msgs = new Vector(10); // Queue of 10        private volatile boolean _start = false;
    
            // queue requests        public synchronized void send(String address, String msg)        {            _start = true;            _msgs.addElement(new SmsMessage(address, msg));        }
    
            public synchronized void stop()        {            _stop = true;            try {                if ( _mc != null ){                    _mc.close();                }            } // catch (IOException e ) {                catch (Throwable t) {                t.printStackTrace();                System.exit(0);            }
    
            }
    
            public void run()        {            try {                //closed by the stop() method                _mc = (MessageConnection)Connector.open("sms://");
    
                    if (_mc != null)                {                    // set a listener to trap outgoing sms messages                    _mc.setMessageListener(new OutboundSMSListener());                }                for(;;)                {                    while( !_start && !_stop)                    {                        try {                            sleep(TIMEOUT);                        } // catch (InterruptedException e) {                            catch (Throwable t) {                                t.printStackTrace();                                System.exit(0);                            }                    }                    if ( _stop )                    {                        return;                    }
    
                        while(true)                    {                        try {                            SmsMessage sms = null;                            synchronized (this)                            {                                if ( !_msgs.isEmpty() )                                {                                    sms = (SmsMessage)_msgs.firstElement();                                    // take it out of the queue once we sent it                                    _msgs.removeElement(sms);                                }                                else                                {                                    _start = false;                                    break;                                }                            }
    
                                _mc.send(sms.toMessage(_mc));
    
                            } // catch (IOException e) {                            catch (Throwable t) {                                t.printStackTrace();                                System.exit(0);                        }                    }                }            } // catch (IOException e)              catch (Throwable t) {                t.printStackTrace();                System.exit(0);              }        }    } // SendThread
    
        private static final class OutboundSMSListener implements OutboundMessageListener    {        public void notifyIncomingMessage(MessageConnection messageconnection)        {            // we don't care about incoming sms messages right now        }
    
            public void notifyOutgoingMessage(Message message)        {            Dialog.alert("Detected An Outgoing SMS Event");        }    }
    

    Thank you. Makes sense.

  • ADD A SECOND LISTENER TO USING SRVCTL COMMAND

    Hi all

    My CAR has w nodes (10g 10.2.0.4)
    He already has a registry with the CRS (NODE1_LISTENER1 at its home port of ASM 1521) default listening port and I have already create a listener to second manually on both nodes.
    My question is how to add this listener (NODE1_listener1) using srvctl not the netca
    Thanks in advance.
    Respect,
    Tom

    srvctl add listener only is not supported in 10g,.
    but in 11g, you can add listener using srvctl

    10g:
    http://download.Oracle.com/docs/CD/B19306_01/RAC.102/b14197/srvctladmin.htm#RACAD5002

    11g:
    http://download.Oracle.com/docs/CD/B28359_01/RAC.111/b28254/srvctladmin.htm#CDCEECFB

    Therefore, you must use netca to help on 10g

  • incoming SMS listener test

    Hi all. Writing a listener SMS coming that I want to test. But can someone please pass me how I can configure the SDK BB 5 (not the Eclipse plugin) running on Windows 7, so that I can send an SMS to test an emulator to another to see what is happening. Thank you so much as always.

    Found answer in another post from Kanaksony. His response was to use 1 emulator with the following:

    You need to sms-source port and sms-destination ports even in Simulator. Go to JDE-> Edit-> preferences-> tab-> port sms-source Simulator: 21316 and port destination sms: 21316

  • Running the background (sms listening thread) connected to the GUI (another point of entry) application thread

    Hi, I'm new to the development of Blackberry, I read everything on the application running at startup and have a different point of entry for this application. I still need help with my application

    I use BB JDE 4.7

    Simulator: BB 9530 4.7.0

    I'm developing an application of SMS. (extends UiApplication)

    1) there is a thread that listens for incoming messages

    2) there is a wire which is a SMS sender

    3) there is a main screen and two full screens. for example, when the user clicks a button in one of the screens full... I send you a message

    (4) when a message is received, based on the content of the message I push either a full screen

    (5) I have, all the wires and screens as the class internal to the main class that extends from the UiApplication.

    I got the basic features. I need help making that demand the application of autostartup

    (1) I need to start listening to the sms thread when the BB phone starts

    (2) I need to have the application icon in the applications screen as another entry point for the application (only for the GUI), and the listening thread must remain active in the background.

    (3) when an incoming message is detected, the application GUI should be brought to the foreground (if it isn't already forground) after posting a popup (instead of bring the application to the foreground, is it better to display a flashing icon in the status bar of the home screen blackberry and perhaps global popup)

    (4) when the GUI of the application part is closed, I need to stop the sms sending thread, and when the system shuts down, I need to stop the listening thread.

    Please help me guys... I have read many articles and discussions regarding the automatic start-up of applications, another point of entry, the # of background threads...

    but I couldn't find how to implement my needs.

    (1) should I need to create two different projects (applications [GUI thread, a sender] and one for the listening thread)? or I can achieve in single application?

    (2) should I have to sign in the background thread to the GUI app? If so, how?

    (3) it is necessary to use the RunTimeStore object? If so, I don't know how I can bring to the foreground the application GUI of the background thread.

    (4) if I have to stop the thread of listening by overiding onExit() method, the important question I have is, if the onExit() method is only for applications that extends from the Application class and not for the UiApplication class?

    (5) if I should have two projects (one main and the other as a spare point entry), which project should I do as "autorun at startup" and a "system module".

    As I need to have the background still running thread when the GUI application is active. I don't know how I do.

    Hello world...

    I reached my needs thanks to a single application. I used an other entry point.

    To refer to chk my other post

    http://supportforums.BlackBerry.com/T5/Java-development/how-to-avoid-creating-two-instances-of-the-a...

  • Can iTunes be listened to using non-Apple (Airport Express/Extreme example) devices?

    Hi guys, my first question to the forum and hope you can offer some advice.

    One of my friends would like to extend his network wi - fi wireless and listen to their iTunes library throughout the House. It has a large router broadband modem/hub and BT Infinity2. I was going to suggest linking an Airport Express and Airport Extreme solution to install broadband from BT, but in the case where it is costly to use non-Apple devices to stream music from iTunes?

    Any help greatly received.

    All my best

    Wuidar

    can I use non-Apple devices to stream music from iTunes?

    Much would depend on what device you want to listen to music to. Is - this AirPlay device is capable?

  • How to manage Navigation between pages using Cascades

    Hello

    I want to make navigation between the current page and new Page, I tried to use the navigationPane, but I still don't get, again, I'm new to C++, if I create a new FirstPage Class, which contains .cpp and h. files there if ranging from waterfalls, and iin the click button, I should be going to the page? Any sample code will be useful,

    Concerning

    Rakesh shankar, P

    Hello

    I have posted the solution in your other thread.

    http://supportforums.BlackBerry.com/T5/Cascades-development/doubts-regarding-the-creating-stack-of-s...

    In the future please try to stick to one thread to make it easier for others to find solutions to the problems.

    See you soon

    Swann

  • LOVs using cascading on the Page elements with values exceeding 4000 characters

    A few days ago, I asked a question on the community, but it turned out that there was something wrong with my account and they have removed the item, so I'll just post the solution I found here now:

    Well, I found a way to use LOVs cascading on page elements with values exceeding 4000 characters:

    Let's say I have a shuttle named P1_ORGANISATIE with "List of values" box, a dynamic LOV named "Source: lists of values Query" containing the value:

    Select NAAM as display_value, ID like return_value

    of NINEHAM

    order by 1

    If the number of records-NINEHAM is insufficient, the length of the value of P1_ORGANISATIE, which is a list of concatenated with colon separated digital ID, can exceed 4000 characters.

    Now, suppose I have a list of selection called P1_TEST that is connected through "List of values"-> "Cascading LOV Parent article (s)" with P1_ORGANISATIE, using a named LOV dynamic with "Source: lists of values Query" containing:

    Select distinct TST. NAAM as display_value, TST.ID as return_value

    of the OTE NINEHAM

    Join the AFDELINGEN ADG ON (ADG. OTE_ID = OTE.ID)

    Join the DEELNEMERS DNR ON (DNR. ADG_ID = ADG.ID)

    Join TESTDEELNEMERS TDR WE (TDR. DNR_ID = DNR.ID)

    Join TESTEN TST ON (TST.ID = RDT. TST_ID)

    where instr (":" |: P1_ORGANISATIE |) '':'', '':'' || OTE.ID | :'') > 0

    order by 1

    In this case, when P1_ORGANISATIE exceeds 3998 characters, you'll get an "ORA-01704: string literal too long"-error and the P1_TEST will show an element called "undefined".

    A way around this is possible because for a named LOV, you can use a "function that returns a sql query" instead of a simple sql query. In other words, we can apply in the context of PL/SQL and thus have maximum for expressions of 32767 instead of 4000 characters. In addition, it is possible to use the two APEX_UTIL. STRING_TO_TABLE and APEX_COLLECTION.

    Setting "Source: lists of query values" on the LOV appointed to P1_TEST with the following code will work:

    DECLARE

    l_selected APEX_APPLICATION_GLOBAL. VC_ARR2;

    l_qry varchar2 (32767): =.

    "Select distinct TST. NAAM as display_value, TST.ID as return_value

    of the OTE NINEHAM

    Join the AFDELINGEN ADG ON (ADG. OTE_ID = OTE.ID)

    Join the DEELNEMERS DNR ON (DNR. ADG_ID = ADG.ID)

    Join TESTDEELNEMERS TDR WE (TDR. DNR_ID = DNR.ID)

    Join TESTEN TST ON (TST.ID = RDT. TST_ID)

    $1

    order by 1';

    BEGIN

    IF: P1_ORGANISATIE IS NULL

    OR LENGTH(:P1_ORGANISATIE) < = 4000

    THEN RETURN

    Replace (l_qry

    ,'$1'

    ,' where instr (":" |: P1_ORGANISATIE |) '':'', '':'' || OTE.ID | :'') > 0'

    );

    ON THE OTHER

    l_selected: = APEX_UTIL. STRING_TO_TABLE(:P1_ORGANISATIE);

    APEX_COLLECTION. CREATE_OR_TRUNCATE_COLLECTION (p_collection_name = > 'ORGANISATIE_COLLECTIE');

    FOR id IN 1.l_selected.count

    LOOP

    APEX_COLLECTION.add_member (p_collection_name = > 'ORGANISATIE_COLLECTIE')

    , p_n001 = > to_number (l_selected (id))

    );

    END LOOP;

    RETURN

    Replace (l_qry

    ,'$1'

    ,'join apex_collections ON APC (APC. COLLECTION_NAME = "ORGANISATIE_COLLECTIE" AND APC. N001 = OTE.ID)"

    );

    END IF;

    END;

    Andreas Groenevelt says:

    A few days ago, I asked a question on the community, but it turned out that there was something wrong with my account and they have removed the item, so I'll just post the solution I found here now:

    Something was wrong with the whole site: AP invoice tolerance

    I don't post anything substantive until we find out what is happening.

  • SMS alerts by using the local GSM modem and smstools v2

    Hello

    I know there have been some discussions (ish) similar to this before, but I can't find the answer I'm looking for.

    I have Hyperic HQ installed 4.0.3 on a computer with a connected GSM modem and smstools installed. I know the SMS feature works because I tested sending a message using smstools and I am also able to receive messages.

    My question is this, how do I change the sms_email.gsp file send it an email to smstools so smstools can use the email2sms script.

    If someone managed to get this to work already?

    Kind regards

    Andrew

    This is the groovy... it broke when I tried to enter it in my post.

  • Do I need local listener to use dblink with remote DB?

    Hello
    It seems probably stupid, but I wonder if we really need local listener upward and running when connecting via dblink with remote control.
    In other words when we using a db_link local listener somehow interacts or is that our session local <>- remote_listener-> remote_db?
    I think the version is unimportat here, but say that from 9.2 to 11.2.
    Concerning
    GregG

    Yes. ...
    his will be like any session on tns really, you connect to the listener, he gives you to the upper hole that connects you to the remote database.

  • How to change the directory of apex - listener.xml using container startup options?

    The option proposed in the thread Re: change the URL of earphone APEX (second post by Udo) seems attractive, but being not not Glassfish pro, I do not know how.
    Anyone can indicate in which succession of menus Glassfish should I go to refer - Dconfig_dir =... parameter?

    I run Apex listener on Glassfish 3.1 1.1

    Igor

    Hello Igor.

    the setting -Dconfig_dir = is an option for the JVM, used similar to a shell environment setting.
    You can set this parameter to GlassFish by editing the startserv.bat or shell startserv script, depending on the OS you are using.
    Note that you can use any name, as config_rep is a name arbitrarily chosen for the parameter that I presented for the config file.

    -Udo

  • memory of SMS message in use

    is there to change the memory of sms message from phone to sd card

    If you are worried that they can take a lot of space: SMS are in KB size and if you have loads of them they will not occupy any space on your internal memory.

    If you must keep them safe when you reset or repair your phone, you can always save their app is "backup & restore" on your phone or PC Companion on your desktop/laptop.

Maybe you are looking for