Esempio n. 1
0
void MessageWidget::sendSmsThread(QString message)
{

    MessageThread thread = this->messageThreadModel.getThread(this->sortModel.filterRegExp().pattern());
    QString number = thread.getNumber();

    if (number == "")
        return;
    sendToClient("SEND_SMS:"+number.toLatin1()+":"+message.toLatin1());

    addSMS(thread.getId(), "1",QString::number(QDateTime::currentMSecsSinceEpoch()),number,"1","outbox",message);
}
Esempio n. 2
0
HimppMedia::HimppMedia(UsageEnvironment *env, std::string sensor_name)
    : _env(env),
      _sensor(himpp_video_sensor_map.at(sensor_name)),
      _vi_dev(&_sensor, 0), _vi_chan(&_vi_dev, 0),
      _vpss_group(&_vi_chan, 0), _vpss_chan(&_vpss_group, 0),
      _venc_chan0(dynamic_cast<HimppVideoObject*>(&_vpss_chan), 0, 0),
      _venc_chan1(dynamic_cast<HimppVideoObject*>(&_vpss_chan), 1, 1),
      _video_source(*this), _video_encoder0(_venc_chan0), _video_encoder1(_venc_chan1)
{
    ImageResolution r0 = _venc_chan0.getResolution();
    ImageResolution r1("VGA");
    _venc_chan0.setFramerate(25);
    _venc_chan1.setResolution(r1);
    _venc_chan1.setFramerate(25);
    _sysctl.addVideoBuffer(r0.Width * r0.Height * 3 / 2, 8);
    _sysctl.addVideoBuffer(r1.Width * r1.Height * 3 / 2, 4);
    _sysctl.addVideoBuffer(196 * 4, 4);
    _sysctl.enable();

    _sms_list.push_back(addSMS(_video_encoder0));
    _sms_list.push_back(addSMS(_video_encoder1));
}
Esempio n. 3
0
void MessageWidget::readData(QString info)
{
        QString output= info;

        if (output.contains(QRegExp("^GET_SMS_LIST:")))
        {//"GET_SMS_LIST:threadId:messageId:timestamp:number:read:toa:body
            output.remove(QRegExp("^GET_SMS_LIST:"));
            int i;
            QString threadId,messageId,timestamp,number,read,toa,body;

            i = output.indexOf(":");
            threadId = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            messageId = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            timestamp = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            number = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            read = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            toa = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            body = output;

            addSMS(threadId,messageId,timestamp,number,read,toa,body);
        }
}
Esempio n. 4
0
void MessageWidget::newConnection()
{
    QTcpSocket *socket = this->tcpServer.nextPendingConnection();
    if (socket->waitForReadyRead(2000))
    {
        QString output= QString::fromUtf8(socket->readAll());


        if (output.contains(QRegExp("^SMS_RECEIVED:")))
        {//"SMS_RECEIVED:number:body
            output.remove(QRegExp("^SMS_RECEIVED:"));

            int i;
            QString number,body;

            i = output.indexOf(":");
            number = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            body = output;

            emit this->smsReceived(this->contactModel.getName(number),body);
        }
        else if (output.contains(QRegExp("^GET_SMS_LIST:")))
        {//"GET_SMS_LIST:threadId:messageId:timestamp:number:read:toa:body
            output.remove(QRegExp("^GET_SMS_LIST:"));
            int i;
            QString threadId,messageId,timestamp,number,read,toa,body;

            i = output.indexOf(":");
            threadId = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            messageId = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            timestamp = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            number = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            read = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            toa = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            body = output;

            addSMS(threadId,messageId,timestamp,number,read,toa,body);
        }
        else if (output.contains(QRegExp("^GET_CONTACT_LIST:")))
        {
            output.remove(QRegExp("^GET_CONTACT_LIST:"));
            QString id,number,name;
            int i;

            i = output.indexOf(":");
            id = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            name = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            number = output;
            number.remove("\n");

            addContact(id,number,name);
        }

        socket->disconnectFromHost();
    }
    delete socket;
}
Esempio n. 5
0
void MessageWidget::readMesg()
{
    bool b = socket->canReadLine();
    while(socket->canReadLine())
    {

        QString output= QString::fromUtf8(socket->readLine());

        if (output.contains(QRegExp("^SMS_RECEIVED:")))
        {//"SMS_RECEIVED:number:body
            output.remove(QRegExp("^SMS_RECEIVED:"));

            int i;
            QString number,body;

            i = output.indexOf(":");
            number = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            body = output;

            emit this->smsReceived(this->contactModel.getName(number),body);
        }
        else if (output.contains(QRegExp("^GET_SMS_LIST:")))
        {//"GET_SMS_LIST:threadId:messageId:timestamp:number:read:toa:body
            output.remove(QRegExp("^GET_SMS_LIST:"));
            int i;
            QString threadId,messageId,timestamp,number,read,toa,body;

            i = output.indexOf(":");
            threadId = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            messageId = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            timestamp = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            number = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            read = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            toa = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            body = output;

            addSMS(threadId,messageId,timestamp,number,read,toa,body);
        }
        else if (output.contains(QRegExp("^GET_CONTACT_LIST:")))
        {
            output.remove(QRegExp("^GET_CONTACT_LIST:"));
            QString id,number,name;
            int i;

            i = output.indexOf(":");
            id = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            name = output.left(i);
            output.remove(0,i+1);

            i = output.indexOf(":");
            number = output;
            number.remove("\n");

            addContact(id,number,name);
        }
    }
        //socket->disconnectFromHost();
}