first blood

This commit is contained in:
Vladislav Khorev 2013-01-19 21:55:39 +00:00
parent 0c970f9b1e
commit a924b8707f
117 changed files with 11270 additions and 0 deletions

View File

@ -0,0 +1,37 @@
#ifndef CUSTOMBUTTON_H
#define CUSTOMBUTTON_H
#include <QtGui/QtGui>
#include "observerclientmodel.h"
class TCustomButton : public QPushButton
{
Q_OBJECT
public:
explicit TCustomButton(QWidget *parent=0)
: QPushButton(parent)
{
}
explicit TCustomButton(const QString &text, QWidget *parent=0)
: QPushButton(text, parent)
{
}
boost::function<void()> PressedHandler;
protected:
virtual void mouseReleaseEvent ( QMouseEvent * e )
{
QAbstractButton::mouseReleaseEvent(e);
PressedHandler();
}
};
#endif // CUSTOMBUTTON_H

View File

@ -0,0 +1,42 @@
#-------------------------------------------------
#
# Project created by QtCreator 2012-08-22T11:32:24
#
#-------------------------------------------------
QT += core gui
QT += webkit
CONFIG += no_keywords
TARGET = K-observer_client
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
../common/UserInfo.cpp \
../common/misc.cpp \
../common/MessageSender.cpp \
observerclientmodel.cpp \
../common/ClientSocket.cpp \
customtimer.cpp
HEADERS += mainwindow.h \
../common/UserInfo.h \
../common/misc.h \
../common/MessageSender.h \
observerclientmodel.h \
../common/ClientSocket.h \
CustomButton.h \
customtimer.h
INCLUDEPATH += C:/Workplace/libs/boost_1_47_0/
INCLUDEPATH += ../common/
LIBS += -LC:/Workplace/libs/boost_1_47_0/boost_windows/libs_engine/debug/
LIBS += -LC:/Workplace/libs/boost_1_47_0/boost_windows/libs_engine/release/
FORMS += mainwindow.ui

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,240 @@
/********************************************************************************
** Form generated from reading UI file 'mainwindow.ui'
**
** Created: Sat 25. Aug 20:45:30 2012
** by: Qt User Interface Compiler version 4.8.1
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_MAINWINDOW_H
#define UI_MAINWINDOW_H
#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QComboBox>
#include <QtGui/QDoubleSpinBox>
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
#include <QtGui/QLineEdit>
#include <QtGui/QMainWindow>
#include <QtGui/QMenuBar>
#include <QtGui/QPushButton>
#include <QtGui/QSpinBox>
#include <QtGui/QStatusBar>
#include <QtGui/QTextEdit>
#include <QtGui/QToolBar>
#include <QtGui/QWidget>
#include <QtWebKit/QWebView>
#include "custombutton.h"
QT_BEGIN_NAMESPACE
class Ui_MainWindow
{
public:
QWidget *centralWidget;
TCustomButton *ConnectButton;
QLineEdit *AddressField;
QLineEdit *LastNameField;
QLabel *label;
QLabel *label_2;
QLineEdit *FirstNameField;
QLabel *label_3;
QLineEdit *MiddleNameField;
QLabel *label_4;
QLineEdit *PhoneNumberField;
QSpinBox *UikSpinBox;
QLabel *label_5;
QComboBox *StatusComboBox;
QLabel *label_6;
TCustomButton *UpdateDataButton;
QWebView *webView;
QDoubleSpinBox *PosXSpinBox;
QDoubleSpinBox *PosYSpinBox;
QLabel *label_7;
QLabel *label_8;
QComboBox *MapStateComboBox;
QPushButton *AlarmButton;
QLineEdit *PortField;
TCustomButton *DisconnectButton;
TCustomButton *MapTypeButton;
QComboBox *MapTypeComboBox;
QTextEdit *ChatList;
QLineEdit *ChatTextLine;
TCustomButton *ChatSendButton;
QMenuBar *menuBar;
QToolBar *mainToolBar;
QStatusBar *statusBar;
void setupUi(QMainWindow *MainWindow)
{
if (MainWindow->objectName().isEmpty())
MainWindow->setObjectName(QString::fromUtf8("MainWindow"));
MainWindow->resize(646, 543);
centralWidget = new QWidget(MainWindow);
centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
ConnectButton = new TCustomButton(centralWidget);
ConnectButton->setObjectName(QString::fromUtf8("ConnectButton"));
ConnectButton->setGeometry(QRect(10, 30, 91, 23));
AddressField = new QLineEdit(centralWidget);
AddressField->setObjectName(QString::fromUtf8("AddressField"));
AddressField->setGeometry(QRect(10, 10, 111, 20));
LastNameField = new QLineEdit(centralWidget);
LastNameField->setObjectName(QString::fromUtf8("LastNameField"));
LastNameField->setGeometry(QRect(10, 110, 113, 20));
label = new QLabel(centralWidget);
label->setObjectName(QString::fromUtf8("label"));
label->setGeometry(QRect(10, 90, 46, 13));
label_2 = new QLabel(centralWidget);
label_2->setObjectName(QString::fromUtf8("label_2"));
label_2->setGeometry(QRect(10, 140, 46, 13));
FirstNameField = new QLineEdit(centralWidget);
FirstNameField->setObjectName(QString::fromUtf8("FirstNameField"));
FirstNameField->setGeometry(QRect(10, 160, 113, 20));
label_3 = new QLabel(centralWidget);
label_3->setObjectName(QString::fromUtf8("label_3"));
label_3->setGeometry(QRect(10, 190, 71, 16));
MiddleNameField = new QLineEdit(centralWidget);
MiddleNameField->setObjectName(QString::fromUtf8("MiddleNameField"));
MiddleNameField->setGeometry(QRect(10, 210, 113, 20));
label_4 = new QLabel(centralWidget);
label_4->setObjectName(QString::fromUtf8("label_4"));
label_4->setGeometry(QRect(10, 240, 121, 16));
PhoneNumberField = new QLineEdit(centralWidget);
PhoneNumberField->setObjectName(QString::fromUtf8("PhoneNumberField"));
PhoneNumberField->setGeometry(QRect(10, 260, 113, 20));
UikSpinBox = new QSpinBox(centralWidget);
UikSpinBox->setObjectName(QString::fromUtf8("UikSpinBox"));
UikSpinBox->setGeometry(QRect(10, 310, 111, 22));
label_5 = new QLabel(centralWidget);
label_5->setObjectName(QString::fromUtf8("label_5"));
label_5->setGeometry(QRect(10, 290, 121, 16));
StatusComboBox = new QComboBox(centralWidget);
StatusComboBox->setObjectName(QString::fromUtf8("StatusComboBox"));
StatusComboBox->setGeometry(QRect(10, 360, 131, 22));
label_6 = new QLabel(centralWidget);
label_6->setObjectName(QString::fromUtf8("label_6"));
label_6->setGeometry(QRect(10, 340, 121, 16));
UpdateDataButton = new TCustomButton(centralWidget);
UpdateDataButton->setObjectName(QString::fromUtf8("UpdateDataButton"));
UpdateDataButton->setGeometry(QRect(10, 390, 131, 23));
webView = new QWebView(centralWidget);
webView->setObjectName(QString::fromUtf8("webView"));
webView->setGeometry(QRect(220, 10, 401, 251));
webView->setUrl(QUrl(QString::fromUtf8("about:blank")));
PosXSpinBox = new QDoubleSpinBox(centralWidget);
PosXSpinBox->setObjectName(QString::fromUtf8("PosXSpinBox"));
PosXSpinBox->setGeometry(QRect(262, 270, 81, 22));
PosXSpinBox->setDecimals(6);
PosXSpinBox->setSingleStep(0.001);
PosXSpinBox->setValue(37.4432);
PosYSpinBox = new QDoubleSpinBox(centralWidget);
PosYSpinBox->setObjectName(QString::fromUtf8("PosYSpinBox"));
PosYSpinBox->setGeometry(QRect(372, 270, 81, 22));
PosYSpinBox->setDecimals(6);
PosYSpinBox->setSingleStep(0.01);
PosYSpinBox->setValue(55.8889);
label_7 = new QLabel(centralWidget);
label_7->setObjectName(QString::fromUtf8("label_7"));
label_7->setGeometry(QRect(242, 270, 16, 16));
label_8 = new QLabel(centralWidget);
label_8->setObjectName(QString::fromUtf8("label_8"));
label_8->setGeometry(QRect(352, 270, 16, 16));
MapStateComboBox = new QComboBox(centralWidget);
MapStateComboBox->setObjectName(QString::fromUtf8("MapStateComboBox"));
MapStateComboBox->setGeometry(QRect(462, 270, 151, 22));
AlarmButton = new QPushButton(centralWidget);
AlarmButton->setObjectName(QString::fromUtf8("AlarmButton"));
AlarmButton->setGeometry(QRect(432, 310, 181, 23));
PortField = new QLineEdit(centralWidget);
PortField->setObjectName(QString::fromUtf8("PortField"));
PortField->setGeometry(QRect(130, 10, 61, 20));
DisconnectButton = new TCustomButton(centralWidget);
DisconnectButton->setObjectName(QString::fromUtf8("DisconnectButton"));
DisconnectButton->setGeometry(QRect(110, 30, 75, 23));
MapTypeButton = new TCustomButton(centralWidget);
MapTypeButton->setObjectName(QString::fromUtf8("MapTypeButton"));
MapTypeButton->setGeometry(QRect(332, 300, 75, 23));
MapTypeComboBox = new QComboBox(centralWidget);
MapTypeComboBox->setObjectName(QString::fromUtf8("MapTypeComboBox"));
MapTypeComboBox->setGeometry(QRect(230, 300, 91, 22));
ChatList = new QTextEdit(centralWidget);
ChatList->setObjectName(QString::fromUtf8("ChatList"));
ChatList->setGeometry(QRect(230, 340, 381, 111));
ChatList->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
ChatList->setReadOnly(true);
ChatTextLine = new QLineEdit(centralWidget);
ChatTextLine->setObjectName(QString::fromUtf8("ChatTextLine"));
ChatTextLine->setGeometry(QRect(230, 460, 301, 20));
ChatSendButton = new TCustomButton(centralWidget);
ChatSendButton->setObjectName(QString::fromUtf8("ChatSendButton"));
ChatSendButton->setGeometry(QRect(540, 460, 75, 23));
MainWindow->setCentralWidget(centralWidget);
menuBar = new QMenuBar(MainWindow);
menuBar->setObjectName(QString::fromUtf8("menuBar"));
menuBar->setGeometry(QRect(0, 0, 646, 21));
MainWindow->setMenuBar(menuBar);
mainToolBar = new QToolBar(MainWindow);
mainToolBar->setObjectName(QString::fromUtf8("mainToolBar"));
MainWindow->addToolBar(Qt::TopToolBarArea, mainToolBar);
statusBar = new QStatusBar(MainWindow);
statusBar->setObjectName(QString::fromUtf8("statusBar"));
MainWindow->setStatusBar(statusBar);
retranslateUi(MainWindow);
QMetaObject::connectSlotsByName(MainWindow);
} // setupUi
void retranslateUi(QMainWindow *MainWindow)
{
MainWindow->setWindowTitle(QApplication::translate("MainWindow", "MainWindow", 0, QApplication::UnicodeUTF8));
ConnectButton->setText(QApplication::translate("MainWindow", "\320\237\320\276\320\264\320\272\320\273\321\216\321\207\320\270\321\202\321\214\321\201\321\217", 0, QApplication::UnicodeUTF8));
AddressField->setText(QApplication::translate("MainWindow", "127.0.0.1", 0, QApplication::UnicodeUTF8));
LastNameField->setText(QApplication::translate("MainWindow", "\320\230\320\262\320\260\320\275\320\276\320\262", 0, QApplication::UnicodeUTF8));
label->setText(QApplication::translate("MainWindow", "\320\244\320\260\320\274\320\270\320\273\320\270\321\217:", 0, QApplication::UnicodeUTF8));
label_2->setText(QApplication::translate("MainWindow", "\320\230\320\274\321\217:", 0, QApplication::UnicodeUTF8));
FirstNameField->setText(QApplication::translate("MainWindow", "\320\230\320\262\320\260\320\275", 0, QApplication::UnicodeUTF8));
label_3->setText(QApplication::translate("MainWindow", "\320\236\321\202\321\207\320\265\321\201\321\202\320\262\320\276:", 0, QApplication::UnicodeUTF8));
MiddleNameField->setText(QApplication::translate("MainWindow", "\320\230\320\262\320\260\320\275\320\276\320\262\320\270\321\207", 0, QApplication::UnicodeUTF8));
label_4->setText(QApplication::translate("MainWindow", "\320\232\320\276\320\275\321\202\320\260\320\272\321\202\320\275\321\213\320\271 \321\202\320\265\320\273\320\265\321\204\320\276\320\275:", 0, QApplication::UnicodeUTF8));
PhoneNumberField->setText(QApplication::translate("MainWindow", "1111", 0, QApplication::UnicodeUTF8));
label_5->setText(QApplication::translate("MainWindow", "\320\235\320\276\320\274\320\265\321\200 \320\243\320\230\320\232:", 0, QApplication::UnicodeUTF8));
StatusComboBox->clear();
StatusComboBox->insertItems(0, QStringList()
<< QApplication::translate("MainWindow", "\320\235\320\260\320\261\320\273\321\216\320\264\320\260\321\202\320\265\320\273\321\214", 0, QApplication::UnicodeUTF8)
<< QApplication::translate("MainWindow", "\320\234\320\276\320\261\320\270\320\273\321\214\320\275\320\260\321\217 \320\263\321\200\321\203\320\277\320\277\320\260", 0, QApplication::UnicodeUTF8)
);
label_6->setText(QApplication::translate("MainWindow", "\320\241\321\202\320\260\321\202\321\203\321\201:", 0, QApplication::UnicodeUTF8));
UpdateDataButton->setText(QApplication::translate("MainWindow", "\320\236\320\261\320\275\320\276\320\262\320\270\321\202\321\214 \320\270\320\275\321\204\320\276\321\200\320\274\320\260\321\206\320\270\321\216", 0, QApplication::UnicodeUTF8));
label_7->setText(QApplication::translate("MainWindow", "X:", 0, QApplication::UnicodeUTF8));
label_8->setText(QApplication::translate("MainWindow", "Y:", 0, QApplication::UnicodeUTF8));
MapStateComboBox->clear();
MapStateComboBox->insertItems(0, QStringList()
<< QApplication::translate("MainWindow", "\320\241\320\276\321\201\321\202\320\276\321\217\320\275\320\270\320\265 \320\275\320\276\321\200\320\274", 0, QApplication::UnicodeUTF8)
<< QApplication::translate("MainWindow", "\320\241\320\276\321\201\321\202\320\276\321\217\320\275\320\270\320\265 \321\202\321\200\320\265\320\262\320\276\320\263\320\260", 0, QApplication::UnicodeUTF8)
);
AlarmButton->setText(QApplication::translate("MainWindow", "\320\237\320\276\321\201\320\273\320\260\321\202\321\214 \321\201\320\270\320\263\320\275\320\260\320\273 \321\202\321\200\320\265\320\262\320\276\320\263\320\270", 0, QApplication::UnicodeUTF8));
PortField->setText(QApplication::translate("MainWindow", "1984", 0, QApplication::UnicodeUTF8));
DisconnectButton->setText(QApplication::translate("MainWindow", "PushButton", 0, QApplication::UnicodeUTF8));
MapTypeButton->setText(QApplication::translate("MainWindow", "\320\222\321\213\320\261\321\200\320\260\321\202\321\214", 0, QApplication::UnicodeUTF8));
MapTypeComboBox->clear();
MapTypeComboBox->insertItems(0, QStringList()
<< QApplication::translate("MainWindow", "\320\236\320\261\321\211\320\260\321\217 \320\272\320\260\321\200\321\202\320\260", 0, QApplication::UnicodeUTF8)
<< QApplication::translate("MainWindow", "\320\232\320\260\321\200\321\202\320\260 \321\202\321\200\320\265\320\262\320\276\320\263\320\270", 0, QApplication::UnicodeUTF8)
);
ChatSendButton->setText(QApplication::translate("MainWindow", "\320\236\321\202\320\277\321\200\320\260\320\262\320\270\321\202\321\214", 0, QApplication::UnicodeUTF8));
} // retranslateUi
};
namespace Ui {
class MainWindow: public Ui_MainWindow {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_MAINWINDOW_H

View File

@ -0,0 +1,15 @@
#include "customtimer.h"
#include "observerclientmodel.h"
CustomTimer::CustomTimer(QObject *parent)
: QTimer(parent)
{
}
void CustomTimer::timerEvent ( QTimerEvent * e )
{
TimerSignal();
}

View File

@ -0,0 +1,20 @@
#ifndef CUSTOMTIMER_H
#define CUSTOMTIMER_H
#include <QTimer>
#include <QTimerEvent>
#include "UserInfo.h"
class CustomTimer : public QTimer
{
Q_OBJECT
public:
explicit CustomTimer(QObject *parent = 0);
boost::signal<void()> TimerSignal;
protected:
virtual void timerEvent ( QTimerEvent * e );
};
#endif // CUSTOMTIMER_H

View File

@ -0,0 +1,38 @@
#include <QtGui/QApplication>
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "observerclientmodel.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
TObserverClientModel observerClient;
w.ObserverClientModel = &observerClient;
observerClient.MainWindowPtr = &w;
w.OpenMap();
w.GetUi()->ConnectButton->PressedHandler = boost::bind(&TObserverClientModel::OnConnectButtonPressed, &observerClient);
w.GetUi()->UpdateDataButton->PressedHandler = boost::bind(&TObserverClientModel::OnUpdateInfoButtonPressed, &observerClient);
w.GetUi()->DisconnectButton->PressedHandler = boost::bind(&TObserverClientModel::Finish, &observerClient);
w.GetUi()->MapTypeButton->PressedHandler = boost::bind(&TObserverClientModel::OnChangeMapTypeButtonPressed, &observerClient);
w.GetUi()->ChatSendButton->PressedHandler = boost::bind(&TObserverClientModel::OnChatSendClick, &observerClient);
w.GetUi()->AlarmButton->PressedHandler = boost::bind(&TObserverClientModel::OnSendAlarmClick, &observerClient);
w.GetUi()->KickButton->PressedHandler = boost::bind(&TObserverClientModel::OnKickPlayerClick, &observerClient);
w.GetUi()->SelectPlayerButton->PressedHandler = boost::bind(&TObserverClientModel::OnSelectPlayerClick, &observerClient);
return a.exec();
}

View File

@ -0,0 +1,35 @@
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QtWebKit>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::closeEvent(QCloseEvent *event)
{
if (ObserverClientModel->Connected)
{
ObserverClientModel->Finish();
}
event->accept();
}
void MainWindow::OpenMap()
{
QUrl url("C:/Workplace/Projects/k_observer/K-observer_client_qt/script.html");
ui->webView->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
ui->webView->load(url);
}

View File

@ -0,0 +1,39 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class TObserverClientModel;
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
Ui::MainWindow* GetUi()
{
return ui;
}
void OpenMap();
TObserverClientModel* ObserverClientModel;
protected:
void closeEvent(QCloseEvent *event);
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H

View File

@ -0,0 +1,605 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>846</width>
<height>607</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralWidget">
<widget class="TCustomButton" name="ConnectButton">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>91</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Подключиться</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
</widget>
<widget class="QLineEdit" name="AddressField">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>111</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>127.0.0.1</string>
</property>
</widget>
<widget class="QLineEdit" name="LastNameField">
<property name="geometry">
<rect>
<x>10</x>
<y>110</y>
<width>113</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Иванов</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<width>46</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Фамилия:</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>10</x>
<y>140</y>
<width>46</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Имя:</string>
</property>
</widget>
<widget class="QLineEdit" name="FirstNameField">
<property name="geometry">
<rect>
<x>10</x>
<y>160</y>
<width>113</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Иван</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>10</x>
<y>190</y>
<width>71</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Отчество:</string>
</property>
</widget>
<widget class="QLineEdit" name="MiddleNameField">
<property name="geometry">
<rect>
<x>10</x>
<y>210</y>
<width>113</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>Иванович</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>10</x>
<y>240</y>
<width>121</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Контактный телефон:</string>
</property>
</widget>
<widget class="QLineEdit" name="PhoneNumberField">
<property name="geometry">
<rect>
<x>10</x>
<y>260</y>
<width>113</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>1111</string>
</property>
</widget>
<widget class="QSpinBox" name="UikSpinBox">
<property name="geometry">
<rect>
<x>10</x>
<y>310</y>
<width>111</width>
<height>22</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>10</x>
<y>290</y>
<width>121</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Номер УИК:</string>
</property>
</widget>
<widget class="QComboBox" name="StatusComboBox">
<property name="geometry">
<rect>
<x>10</x>
<y>360</y>
<width>131</width>
<height>22</height>
</rect>
</property>
<item>
<property name="text">
<string>Наблюдатель</string>
</property>
</item>
<item>
<property name="text">
<string>Мобильная группа</string>
</property>
</item>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>10</x>
<y>340</y>
<width>121</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Статус:</string>
</property>
</widget>
<widget class="TCustomButton" name="UpdateDataButton">
<property name="geometry">
<rect>
<x>10</x>
<y>390</y>
<width>131</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Обновить информацию</string>
</property>
</widget>
<widget class="QWebView" name="webView">
<property name="geometry">
<rect>
<x>220</x>
<y>10</y>
<width>401</width>
<height>251</height>
</rect>
</property>
<property name="url">
<url>
<string>about:blank</string>
</url>
</property>
</widget>
<widget class="QDoubleSpinBox" name="PosXSpinBox">
<property name="geometry">
<rect>
<x>262</x>
<y>270</y>
<width>81</width>
<height>22</height>
</rect>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="singleStep">
<double>0.001000000000000</double>
</property>
<property name="value">
<double>30.215800000000002</double>
</property>
</widget>
<widget class="QDoubleSpinBox" name="PosYSpinBox">
<property name="geometry">
<rect>
<x>372</x>
<y>270</y>
<width>81</width>
<height>22</height>
</rect>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="singleStep">
<double>0.001000000000000</double>
</property>
<property name="value">
<double>60.005200000000002</double>
</property>
</widget>
<widget class="QLabel" name="label_7">
<property name="geometry">
<rect>
<x>242</x>
<y>270</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>X:</string>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>352</x>
<y>270</y>
<width>16</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Y:</string>
</property>
</widget>
<widget class="QComboBox" name="MapStateComboBox">
<property name="geometry">
<rect>
<x>462</x>
<y>270</y>
<width>151</width>
<height>22</height>
</rect>
</property>
<item>
<property name="text">
<string>Состояние норм</string>
</property>
</item>
<item>
<property name="text">
<string>Состояние тревога</string>
</property>
</item>
</widget>
<widget class="TCustomButton" name="AlarmButton">
<property name="geometry">
<rect>
<x>432</x>
<y>310</y>
<width>181</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Послать сигнал тревоги</string>
</property>
</widget>
<widget class="QLineEdit" name="PortField">
<property name="geometry">
<rect>
<x>130</x>
<y>10</y>
<width>61</width>
<height>20</height>
</rect>
</property>
<property name="text">
<string>1984</string>
</property>
</widget>
<widget class="TCustomButton" name="DisconnectButton">
<property name="geometry">
<rect>
<x>110</x>
<y>30</y>
<width>91</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Отключиться</string>
</property>
</widget>
<widget class="TCustomButton" name="MapTypeButton">
<property name="geometry">
<rect>
<x>332</x>
<y>300</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Выбрать</string>
</property>
</widget>
<widget class="QComboBox" name="MapTypeComboBox">
<property name="geometry">
<rect>
<x>230</x>
<y>300</y>
<width>91</width>
<height>22</height>
</rect>
</property>
<item>
<property name="text">
<string>Общая карта</string>
</property>
</item>
<item>
<property name="text">
<string>Карта тревоги</string>
</property>
</item>
</widget>
<widget class="QTextEdit" name="ChatList">
<property name="geometry">
<rect>
<x>230</x>
<y>340</y>
<width>381</width>
<height>111</height>
</rect>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
<widget class="QLineEdit" name="ChatTextLine">
<property name="geometry">
<rect>
<x>230</x>
<y>460</y>
<width>301</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="TCustomButton" name="ChatSendButton">
<property name="geometry">
<rect>
<x>540</x>
<y>460</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Отправить</string>
</property>
</widget>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>630</x>
<y>10</y>
<width>211</width>
<height>191</height>
</rect>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>70</x>
<y>0</y>
<width>46</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Админка:</string>
</property>
</widget>
<widget class="TCustomButton" name="KickButton">
<property name="geometry">
<rect>
<x>70</x>
<y>160</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Кикнуть</string>
</property>
</widget>
<widget class="QLineEdit" name="LastNameKickEdit">
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>171</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="FirstNameKickEdit">
<property name="geometry">
<rect>
<x>10</x>
<y>90</y>
<width>171</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLineEdit" name="MiddleNameKickEdit">
<property name="geometry">
<rect>
<x>10</x>
<y>130</y>
<width>171</width>
<height>20</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label_10">
<property name="geometry">
<rect>
<x>10</x>
<y>70</y>
<width>46</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Имя:</string>
</property>
</widget>
<widget class="QLabel" name="label_11">
<property name="geometry">
<rect>
<x>10</x>
<y>30</y>
<width>46</width>
<height>13</height>
</rect>
</property>
<property name="text">
<string>Фамилия:</string>
</property>
</widget>
<widget class="QLabel" name="label_12">
<property name="geometry">
<rect>
<x>10</x>
<y>110</y>
<width>61</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Отчество:</string>
</property>
</widget>
</widget>
<widget class="QListWidget" name="PlayerListWidget">
<property name="geometry">
<rect>
<x>630</x>
<y>210</y>
<width>181</width>
<height>191</height>
</rect>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOn</enum>
</property>
</widget>
<widget class="TCustomButton" name="SelectPlayerButton">
<property name="geometry">
<rect>
<x>660</x>
<y>400</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Выбрать</string>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menuBar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>846</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QToolBar" name="mainToolBar">
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
<widget class="QStatusBar" name="statusBar"/>
</widget>
<layoutdefault spacing="6" margin="11"/>
<customwidgets>
<customwidget>
<class>QWebView</class>
<extends>QWidget</extends>
<header>QtWebKit/QWebView</header>
</customwidget>
<customwidget>
<class>TCustomButton</class>
<extends>QPushButton</extends>
<header>custombutton.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,390 @@
#include "observerclientmodel.h"
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QWebFrame>
QString
ws2qs(const std::wstring& str)
{
return (QString((const QChar*)str.c_str(), str.length()));
}
// Convert a QString to a wstring
std::wstring
qs2ws(const QString& str)
{
return (std::wstring((wchar_t*)str.unicode(), str.length()));
}
TObserverClientModel::TObserverClientModel(QObject *parent)
: QObject(parent)
, MapType(0)
, Connected(false)
{
}
void TObserverClientModel::Start(std::string address, std::string port)
{
if (!Connected)
{
ClientSocket = boost::shared_ptr<TClientSocket>(new TClientSocket(IoService));
ClientSocket->ReceiveMapSignal.connect(boost::bind(&TObserverClientModel::OnReceiveMapUpdate, this, _1));
ClientSocket->ReceiveAlarmMapSignal.connect(boost::bind(&TObserverClientModel::OnReceiveAlarmMapUpdate, this, _1));
ClientSocket->ReceiveForceCloseSignal.connect(boost::bind(&TObserverClientModel::OnSocketClosed, this));
ClientSocket->ReceiveMessageSignal.connect(boost::bind(&TObserverClientModel::OnReceiveChatMessage, this, _1, _2));
ClientSocket->ReceiveAutorizationSentSignal.connect(boost::bind(&TObserverClientModel::OnAutorizationSent, this));
ClientSocket->Open(address, port);
IoServiceThread = boost::thread(boost::bind(&TObserverClientModel::DoRunIoService, this));
Timer.TimerSignal.connect(boost::bind(&TObserverClientModel::OnUpdateMapTimer, this));
Timer.start(1000);
Connected = true;
}
}
void TObserverClientModel::OnAutorizationSent()
{
RestartHeartbeatTimer();
RestartMapHeartbeatTimer();
}
void TObserverClientModel::RestartHeartbeatTimer()
{
HeartbeatTimer = boost::shared_ptr<boost::asio::deadline_timer>(new boost::asio::deadline_timer(IoService, boost::posix_time::seconds(3)));
HeartbeatTimer->async_wait(boost::bind(&TObserverClientModel::OnHeartbeat, this, boost::asio::placeholders::error));
}
void TObserverClientModel::RestartMapHeartbeatTimer()
{
MapHeartbeatTimer = boost::shared_ptr<boost::asio::deadline_timer>(new boost::asio::deadline_timer(IoService, boost::posix_time::seconds(3)));
MapHeartbeatTimer->async_wait(boost::bind(&TObserverClientModel::OnMapHeartbeat, this, boost::asio::placeholders::error));
}
void TObserverClientModel::Finish()
{
if (Connected)
{
Connected = false;
Timer.stop();
HeartbeatTimer->cancel();
MapHeartbeatTimer->cancel();
ClientSocket->CloseImmediate();
}
}
void TObserverClientModel::OnSocketClosed()
{
//ClientSocket->BlockCloseOnError = true;
//ClientSocket->CloseImmediate();
ClientSocket = boost::shared_ptr<TClientSocket>();
}
void TObserverClientModel::OnUpdateMapTimer()
{
UpdatingMapMutex.lock();
MainWindowPtr->GetUi()->webView->page()->mainFrame()->evaluateJavaScript("Clear();");
if (MapType == 0)
{
for (std::vector<TUserInfo>::iterator i = UserInfoArr.begin(); i != UserInfoArr.end(); ++i)
{
QString posX = QString::number( i->PosX );
QString posY = QString::number( i->PosY );
QString mapState = QString::number(i->MapState);
if (i->PosX != 0.f && i->PosY != 0.f)
{
MainWindowPtr->GetUi()->webView->page()->mainFrame()->evaluateJavaScript("AddMarker("+posX+", "+posY+", "+ mapState + ");");
}
}
}
else
{
MainWindowPtr->GetUi()->PlayerListWidget->clear();
for (std::vector<TUserInfo>::iterator i = AlarmUserInfoArr.begin(); i != AlarmUserInfoArr.end(); ++i)
{
QString posX = QString::number( i->PosX );
QString posY = QString::number( i->PosY );
QString mapState = QString::number(i->MapState);
std::wstring Uik = L"ÓÈÊ ¹";
std::wstring StateHeader = L"Ñîñòîÿíèå: ";
QString lastName = QString::fromUtf8(i->LastName.c_str());
QString firstName = QString::fromUtf8(i->FirstName.c_str());
QString middleName = QString::fromUtf8(i->MiddleName.c_str());
QString text = ws2qs(Uik);
text = text + QString::number(i->Uik)+"\\n";
text = text + lastName;
text = text +"\\n" + firstName;
text = text + "\\n"+middleName;
text = text + "\\n"+QString::fromUtf8(i->PhoneNumber.c_str());
text = text + "\\n";
text = text +ws2qs(StateHeader);
std::wstring State;
if (i->MapState == 2)
{
State = L"Òðåâîãà";
}
else if (i->MapState == 3)
{
State = L"Òðåâîãà - Óäàëåíèå ñ ÓÈÊ";
}
else if (i->MapState == 4)
{
State = L"Òðåâîãà - Âáðîñ";
}
else if (i->MapState == 5)
{
State = L"Òðåâîãà - Êàðóñåëü";
}
else if (i->MapState == 6)
{
State = L"Òðåâîãà - Íàïàäåíèå";
}
text += ws2qs(State);
if (i->PosX != 0.f && i->PosY != 0.f)
{
MainWindowPtr->GetUi()->webView->page()->mainFrame()->evaluateJavaScript("AddMarkerWithPopup("+posX+", "+posY+", "+ mapState + ", \"" +text+ "\");");
}
MainWindowPtr->GetUi()->PlayerListWidget->addItem(QString("LastName: "+lastName + " FirstName: " + firstName+" MiddleName: "+middleName));
}
}
Timer.start(1000);
UpdatingMapMutex.unlock();
}
void TObserverClientModel::DoRunIoService()
{
IoService.run();
ReceiveCloseSignal();
ReceiveCloseSignal.disconnect_all_slots();
}
void TObserverClientModel::OnConnectButtonPressed()
{
std::string address(MainWindowPtr->GetUi()->AddressField->text().toAscii());
std::string port(MainWindowPtr->GetUi()->PortField->text().toAscii());
Start(address, port);
}
void TObserverClientModel::OnUpdateInfoButtonPressed()
{
std::string lastName(MainWindowPtr->GetUi()->LastNameField->text().toUtf8());
std::string firstName(MainWindowPtr->GetUi()->FirstNameField->text().toUtf8());
std::string middleName(MainWindowPtr->GetUi()->MiddleNameField->text().toUtf8());
std::string phoneNumber(MainWindowPtr->GetUi()->PhoneNumberField->text().toUtf8());
int uik = MainWindowPtr->GetUi()->UikSpinBox->value();
int status = MainWindowPtr->GetUi()->StatusComboBox->currentIndex();
float posX = MainWindowPtr->GetUi()->PosXSpinBox->value();
float posY = MainWindowPtr->GetUi()->PosYSpinBox->value();
int mapState = MainWindowPtr->GetUi()->MapStateComboBox->currentIndex();
if (status == 1)
{
mapState = 0;
}
ClientSocket->UserInfo.LastName = lastName;
ClientSocket->UserInfo.FirstName = firstName;
ClientSocket->UserInfo.MiddleName = middleName;
ClientSocket->UserInfo.PhoneNumber = phoneNumber;
ClientSocket->UserInfo.Uik = uik;
ClientSocket->UserInfo.Status = status;
ClientSocket->UserInfo.MapState = mapState;
ClientSocket->UserInfo.PosX = posX;
ClientSocket->UserInfo.PosY = posY;
ClientSocket->SendUserinfoUpdateThreaded();
}
void TObserverClientModel::OnHeartbeat(const boost::system::error_code& e)
{
if (e)
{
return;
}
float posX = MainWindowPtr->GetUi()->PosXSpinBox->value();
float posY = MainWindowPtr->GetUi()->PosYSpinBox->value();
int uik = MainWindowPtr->GetUi()->UikSpinBox->value();
int status = MainWindowPtr->GetUi()->StatusComboBox->currentIndex();
int mapState = MainWindowPtr->GetUi()->MapStateComboBox->currentIndex() + 1;
if (status == 1)
{
mapState = 0;
}
ClientSocket->UserInfo.Uik = uik;
ClientSocket->UserInfo.MapState = mapState;
ClientSocket->UserInfo.PosX = posX;
ClientSocket->UserInfo.PosY = posY;
ClientSocket->SendHeartbeatThreaded();
RestartHeartbeatTimer();
}
void TObserverClientModel::OnMapHeartbeat(const boost::system::error_code& e)
{
if (e)
{
return;
}
if (MapType == 0)
{
ClientSocket->SendMapQueryThreaded();
}
else
{
ClientSocket->SendAlarmMapQueryThreaded();
}
RestartMapHeartbeatTimer();
}
void TObserverClientModel::OnReceiveMapUpdate(std::vector<TUserInfo> userInfoArr)
{
UpdatingMapMutex.lock();
UserInfoArr = userInfoArr;
UpdatingMapMutex.unlock();
}
void TObserverClientModel::OnReceiveAlarmMapUpdate(std::vector<TUserInfo> userInfoArr)
{
UpdatingMapMutex.lock();
AlarmUserInfoArr = userInfoArr;
UpdatingMapMutex.unlock();
}
void TObserverClientModel::OnChangeMapTypeButtonPressed()
{
MapType = MainWindowPtr->GetUi()->MapTypeComboBox->currentIndex();
if (MapType == 0)
{
ClientSocket->SendMapQueryThreaded();
}
else
{
ClientSocket->SendAlarmMapQueryThreaded();
}
}
void TObserverClientModel::OnChatSendClick()
{
QString msg = MainWindowPtr->GetUi()->ChatTextLine->text();
ClientSocket->SendMessageThreaded(std::string(msg.toUtf8()));
}
void TObserverClientModel::OnReceiveChatMessage(TUserInfo userInfo, std::string msg)
{
QString qmsg;
qmsg += QString::fromUtf8(userInfo.LastName.c_str()) + " ";
qmsg += QString::fromUtf8(userInfo.FirstName.c_str()) + " ";
qmsg += QString::fromUtf8(userInfo.MiddleName.c_str()) + " ";
qmsg += QString::fromUtf8(userInfo.PhoneNumber.c_str()) + " ";
qmsg += QString(ws2qs(L"ÓÈÊ ¹")) + QString::number(userInfo.Uik) + ": ";
qmsg += QString::fromUtf8(msg.c_str()) + "\n";
MainWindowPtr->GetUi()->ChatList->insertPlainText(qmsg);
}
void TObserverClientModel::OnSendAlarmClick()
{
ClientSocket->UserInfo.MapState = 2;
QString msg = ws2qs(L"Òðåâîãà!");
ClientSocket->SendMessageThreaded(std::string(msg.toUtf8()));
}
void TObserverClientModel::OnKickPlayerClick()
{
QString lastName = MainWindowPtr->GetUi()->LastNameKickEdit->text();
QString firstName = MainWindowPtr->GetUi()->FirstNameKickEdit->text();
QString middleName = MainWindowPtr->GetUi()->MiddleNameKickEdit->text();
ClientSocket->SendKickPlayerThreaded(std::string(lastName.toUtf8()), std::string(firstName.toUtf8()), std::string(middleName.toUtf8()));
}
void TObserverClientModel::OnSelectPlayerClick()
{
int i = MainWindowPtr->GetUi()->PlayerListWidget->currentRow();
QString lastName = QString::fromUtf8(AlarmUserInfoArr[i].LastName.c_str());
QString firstName = QString::fromUtf8(AlarmUserInfoArr[i].FirstName.c_str());
QString middleName = QString::fromUtf8(AlarmUserInfoArr[i].MiddleName.c_str());
MainWindowPtr->GetUi()->LastNameKickEdit->setText(lastName);
MainWindowPtr->GetUi()->FirstNameKickEdit->setText(firstName);
MainWindowPtr->GetUi()->MiddleNameKickEdit->setText(middleName);
}

View File

@ -0,0 +1,86 @@
#ifndef OBSERVERCLIENTMODEL_H
#define OBSERVERCLIENTMODEL_H
#include <QObject>
#include "UserInfo.h"
#include "misc.h"
#include "ClientSocket.h"
#include "customtimer.h"
class MainWindow;
class TObserverClientModel : public QObject
{
Q_OBJECT
public:
explicit TObserverClientModel(QObject *parent = 0);
MainWindow* MainWindowPtr;
boost::shared_ptr<TClientSocket> ClientSocket;
boost::asio::io_service IoService;
boost::thread IoServiceThread;
boost::mutex UpdatingMapMutex;
std::vector<TUserInfo> UserInfoArr;
std::vector<TUserInfo> AlarmUserInfoArr;
CustomTimer Timer;
int MapType;
bool Connected;
void Start(std::string address, std::string port);
void Finish();
void OnSocketClosed();
void RestartHeartbeatTimer();
void RestartMapHeartbeatTimer();
void OnConnectButtonPressed();
void OnUpdateInfoButtonPressed();
void OnChangeMapTypeButtonPressed();
void OnAutorizationSent();
void OnHeartbeat(const boost::system::error_code& e);
void OnMapHeartbeat(const boost::system::error_code& e);
void DoRunIoService();
void OnUpdateMapTimer();
void OnReceiveMapUpdate(std::vector<TUserInfo> userInfoArr);
void OnReceiveAlarmMapUpdate(std::vector<TUserInfo> userInfoArr);
void OnChatSendClick();
void OnReceiveChatMessage(TUserInfo userInfo, std::string msg);
void OnSendAlarmClick();
void OnKickPlayerClick();
void OnSelectPlayerClick();
boost::shared_ptr<boost::asio::deadline_timer> HeartbeatTimer;
boost::shared_ptr<boost::asio::deadline_timer> MapHeartbeatTimer;
boost::signal<void ()> ReceiveCloseSignal;
//signals:
//public slots:
};
#endif // OBSERVERCLIENTMODEL_H

View File

@ -0,0 +1,93 @@
<!DOCTYPE HTML>
<title>OpenLayers Simplest Example</title>
<div id="demoMap" style="height:220px"></div>
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script>
map = new OpenLayers.Map("demoMap");
var mapnik = new OpenLayers.Layer.OSM();
var fromProjection = new OpenLayers.Projection("EPSG:4326"); // Transform from WGS 1984
var toProjection = new OpenLayers.Projection("EPSG:900913"); // to Spherical Mercator Projection
//var position = new OpenLayers.LonLat(37.443195, 55.888869).transform( fromProjection, toProjection);
var position = new OpenLayers.LonLat(30.2158, 60.0052).transform( fromProjection, toProjection);
var zoom = 12;
map.addLayer(mapnik);
map.setCenter(position, zoom);
var markers = new OpenLayers.Layer.Markers( "Markers" );
map.addLayer(markers);
function AddMarker(x, y, state)
{
if (state == 0)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_mobile.png";
}
else if (state == 1)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker.png";
}
else
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_alarm.png";
}
var size = new OpenLayers.Size(21,25);
var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
var icon = new OpenLayers.Icon(marker_addr, size, offset);
var lon_Lat = new OpenLayers.LonLat(x, y).transform(fromProjection, toProjection);
markers.addMarker(new OpenLayers.Marker(lon_Lat, icon));
}
function Clear()
{
markers.clearMarkers();
}
//AddMarker(37.443195, 55.888869);
function AddMarkerWithPopup(x, y, state, text)
{
if (state == 0)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_mobile.png";
}
else if (state == 1)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker.png";
}
else
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_alarm.png";
}
var size = new OpenLayers.Size(21,25);
var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
var icon = new OpenLayers.Icon(marker_addr, size, offset);
var lon_Lat = new OpenLayers.LonLat(x, y).transform(fromProjection, toProjection);
var marker = new OpenLayers.Marker(lon_Lat, icon);
marker.events.register('mousedown', marker, function(evt) { alert(text); OpenLayers.Event.stop(evt); });
markers.addMarker(marker);
}
</script>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding=".svn/" kind="src" path="src"/>
<classpathentry excluding=".svn/" kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="output" path="bin"/>
</classpath>

33
KObserverAndroid/.project Normal file
View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>K-Observer</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,94 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
**
** Copyright 2009, The Android Open Source Project
**
** 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.
*/
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="fishrungames.kobserver" android:versionCode="1" android:versionName="1.0.0">
<application
android:icon="@drawable/ic_menu_template" android:label="K-Выборы">
<activity android:name="ConnectActivity"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:configChanges="orientation|keyboardHidden"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="MainMenuActivity"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:configChanges="orientation|keyboardHidden"
android:noHistory="true">
</activity>
<activity android:name="MapActivity"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:configChanges="orientation|keyboardHidden"
android:noHistory="true">
</activity>
<activity android:name="ProfileActivity"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:configChanges="orientation|keyboardHidden"
android:noHistory="true">
</activity>
<activity android:name="AlarmActivity"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:configChanges="orientation|keyboardHidden"
android:noHistory="true">
</activity>
<activity android:name="MessagesActivity"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:configChanges="orientation|keyboardHidden"
android:noHistory="true">
</activity>
<activity android:name="SendMessageActivity"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:launchMode="singleTask"
android:configChanges="orientation|keyboardHidden"
android:noHistory="true">
</activity>
</application>
<uses-sdk android:minSdkVersion="8"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
</manifest>

View File

@ -0,0 +1,11 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "build.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-8

View File

@ -0,0 +1,105 @@
# Copyright (C) 2009 The Android Open Source Project
#
# 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.
#
LPATH := $(call my-dir)
BOOST_PATH = $(LibsPathCygwin)/boost_1_47_0
#====== BOOST =====================
LOCAL_PATH := $(BOOST_PATH)
include $(CLEAR_VARS)
LOCAL_MODULE := boost
LOCAL_C_INCLUDES := $(BOOST_PATH)
#thread
LOCAL_SRC_FILES := /libs/thread/src/pthread/thread.cpp
LOCAL_SRC_FILES += /libs/thread/src/pthread/once.cpp
#signals
LOCAL_SRC_FILES += /libs/signals/src/connection.cpp
LOCAL_SRC_FILES += /libs/signals/src/named_slot_map.cpp
LOCAL_SRC_FILES += /libs/signals/src/signal_base.cpp
LOCAL_SRC_FILES += /libs/signals/src/slot.cpp
LOCAL_SRC_FILES += /libs/signals/src/trackable.cpp
#system
LOCAL_SRC_FILES += /libs/system/src/error_code.cpp
#regex
LOCAL_SRC_FILES += /libs/regex/src/c_regex_traits.cpp
LOCAL_SRC_FILES += /libs/regex/src/cpp_regex_traits.cpp
LOCAL_SRC_FILES += /libs/regex/src/cregex.cpp
LOCAL_SRC_FILES += /libs/regex/src/fileiter.cpp
LOCAL_SRC_FILES += /libs/regex/src/icu.cpp
LOCAL_SRC_FILES += /libs/regex/src/instances.cpp
LOCAL_SRC_FILES += /libs/regex/src/posix_api.cpp
LOCAL_SRC_FILES += /libs/regex/src/regex.cpp
LOCAL_SRC_FILES += /libs/regex/src/regex_debug.cpp
LOCAL_SRC_FILES += /libs/regex/src/regex_raw_buffer.cpp
LOCAL_SRC_FILES += /libs/regex/src/regex_traits_defaults.cpp
LOCAL_SRC_FILES += /libs/regex/src/static_mutex.cpp
LOCAL_SRC_FILES += /libs/regex/src/usinstances.cpp
LOCAL_SRC_FILES += /libs/regex/src/w32_regex_traits.cpp
LOCAL_SRC_FILES += /libs/regex/src/wc_regex_traits.cpp
LOCAL_SRC_FILES += /libs/regex/src/wide_posix_api.cpp
LOCAL_SRC_FILES += /libs/regex/src/winstances.cpp
#date_time
LOCAL_SRC_FILES += /libs/date_time/src/gregorian/greg_month.cpp
LOCAL_SRC_FILES += /libs/date_time/src/gregorian/greg_weekday.cpp
LOCAL_SRC_FILES += /libs/date_time/src/gregorian/date_generators.cpp
#asio
#nothing
LOCAL_LDLIBS := -llog -Wl
#debug
#LOCAL_CFLAGS := -g -ggdb -O0
#LOCAL_LDLIBS += -g -ggdb
include $(BUILD_STATIC_LIBRARY)
#================= THE APP =======================
LOCAL_PATH:= $(LPATH)
include $(CLEAR_VARS)
LOCAL_STATIC_LIBRARIES := boost
LOCAL_C_INCLUDES := $(BOOST_PATH)
LOCAL_C_INCLUDES += ../../common
LOCAL_MODULE := KObserver
LOCAL_SRC_FILES := main_code.cpp
LOCAL_SRC_FILES += android_api.cpp
LOCAL_SRC_FILES += ../../common/ClientSocket.cpp
LOCAL_SRC_FILES += ../../common/MessageSender.cpp
LOCAL_SRC_FILES += ../../common/misc.cpp
LOCAL_SRC_FILES += ../../common/UserInfo.cpp
LOCAL_LDLIBS := -llog -Wl,-s
include $(BUILD_SHARED_LIBRARY)

View File

@ -0,0 +1,3 @@
APP_STL := gnustl_static
APP_CPPFLAGS += -fexceptions
APP_CPPFLAGS += -frtti

View File

@ -0,0 +1,623 @@
#include "android_api.h"
#include "main_code.h"
#include <iostream>
#include "boost/asio.hpp"
#include "boost/bind.hpp"
#include "boost/shared_ptr.hpp"
#include "boost/shared_array.hpp"
#include "boost/array.hpp"
#include "boost/enable_shared_from_this.hpp"
#include "boost/thread.hpp"
#include <cstdlib>
#include <cstring>
#include <iostream>
#include "ClientSocket.h"
boost::asio::io_service IoService;
boost::thread IoServiceThread;
boost::shared_ptr<TClientSocket> ClientSocket;
boost::mutex connection_mutex;
std::vector<std::string> MessageHeaderArr;
std::vector<std::string> MessageTextArr;
std::vector<std::string> JavaStringHolder;
boost::shared_ptr<boost::asio::deadline_timer> HeartbeatTimer;
boost::shared_ptr<boost::asio::deadline_timer> MapHeartbeatTimer;
std::vector<TUserInfo> UserInfoMapArr;
std::vector<TUserInfo> UserInfoAlarmMapArr;
std::vector<TUserInfo>* CurrentUserInfoMapArr = &UserInfoMapArr;
float LastPosX = 0.f;
float LastPosY = 0.f;
int MapType = 0;
/*
void WriteToFile(std::string text)
{
std::string LogFilename = "/sdcard/hello.txt";
FILE* f = fopen(LogFilename.c_str(), "a");
if (f != NULL)
{
fputs(text.c_str(), f);
fflush(f);
fclose(f);
}
}*/
void IoServiceRun()
{
IoService.run();
ClientSocket = boost::shared_ptr<TClientSocket>();
IoService.reset();
//WriteToFile("lolwaauat\n");
}
void OnAutorizationSent()
{
//WriteToFile("OnAutorizationSent\n");
RestartHeartbeatTimer();
RestartMapHeartbeatTimer();
connection_mutex.unlock();
}
void OnRecieveMapUpdate(std::vector<TUserInfo> userInfoArr)
{
UserInfoMapArr = userInfoArr;
}
void OnRecieveAlarmMapUpdate(std::vector<TUserInfo> userInfoArr)
{
UserInfoAlarmMapArr = userInfoArr;
}
void OnClosed()
{
//WriteToFile("OnClosed\n");
}
JavaVM* JavaVirtualMachine;
template<typename T>
inline std::string tostr(T i)
{
std::ostringstream out;
out << i;
return std::string(out.str());
}
JNIEnv* jenv;
jclass clazzLUSCore;
struct OnReceiveMessage
{
void operator()(TUserInfo userInfo, std::string message)
{
JNIEnv* j_env;
JavaVirtualMachine->GetEnv((void**)&j_env, JNI_VERSION_1_4);
std::string header = tostr<int>(userInfo.Uik) + " " + message;
std::string status;
if (userInfo.Status == 0)
{
status = "Наблюдатель";
}
else
{
status = "Мобильная группа";
}
std::string text = userInfo.LastName
+ " " + userInfo.FirstName
+ " " + userInfo.MiddleName
+ " " + userInfo.PhoneNumber
+ " " + status
+ " УИК №" + tostr<int>(userInfo.Uik)
+ ": " + message;
{
boost::this_thread::disable_interruption di;
MessageHeaderArr.push_back(header);
MessageTextArr.push_back(text);
}
}
};
void OnHeartbeat(const boost::system::error_code& e)
{
if (e)
{
return;
}
/*
float posX = MainWindowPtr->GetUi()->PosXSpinBox->value();
float posY = MainWindowPtr->GetUi()->PosYSpinBox->value();
int uik = MainWindowPtr->GetUi()->UikSpinBox->value();
int status = MainWindowPtr->GetUi()->StatusComboBox->currentIndex();
int mapState = MainWindowPtr->GetUi()->MapStateComboBox->currentIndex() + 1;
if (status == 1)
{
mapState = 0;
}
ClientSocket->UserInfo.Uik = uik;
ClientSocket->UserInfo.MapState = mapState;
ClientSocket->UserInfo.PosX = posX;
ClientSocket->UserInfo.PosY = posY;
*/
ClientSocket->SendHeartbeatThreaded();
RestartHeartbeatTimer();
}
void OnMapHeartbeat(const boost::system::error_code& e)
{
if (e)
{
return;
}
if (MapType == 0)
{
ClientSocket->SendMapQueryThreaded();
}
else
{
ClientSocket->SendAlarmMapQueryThreaded();
}
RestartMapHeartbeatTimer();
}
void RestartHeartbeatTimer()
{
HeartbeatTimer = boost::shared_ptr<boost::asio::deadline_timer>(new boost::asio::deadline_timer(IoService, boost::posix_time::seconds(3)));
HeartbeatTimer->async_wait(boost::bind(&OnHeartbeat, boost::asio::placeholders::error));
}
void RestartMapHeartbeatTimer()
{
MapHeartbeatTimer = boost::shared_ptr<boost::asio::deadline_timer>(new boost::asio::deadline_timer(IoService, boost::posix_time::seconds(3)));
MapHeartbeatTimer->async_wait(boost::bind(&OnMapHeartbeat, boost::asio::placeholders::error));
}
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_Open(JNIEnv * env, jobject obj, jstring addr, jstring port)
{
int JVMResult;
JVMResult = env->GetJavaVM(&JavaVirtualMachine);
jenv = env;
static bool x = false;
if (!x)
{
x = true;
std::string LogFilename = "/sdcard/hello.txt";
FILE* f = fopen(LogFilename.c_str(), "w");
if (f != NULL)
{
fclose(f);
}
}
const char *addr_c;
addr_c = env->GetStringUTFChars(addr, NULL);
if (addr_c == NULL)
{
return;
}
const char *port_c;
port_c = env->GetStringUTFChars(port, NULL);
if (port_c == NULL)
{
return;
}
//WriteToFile("Thread go xxx\n");
connection_mutex.lock();
ClientSocket = boost::shared_ptr<TClientSocket>(new TClientSocket(IoService));
ClientSocket->UserInfo.PosX = LastPosX;
ClientSocket->UserInfo.PosY = LastPosY;
ClientSocket->ReceiveAutorizationSentSignal.connect(boost::bind(&OnAutorizationSent));
ClientSocket->ReceiveForceCloseSignal.connect(boost::bind(&OnClosed));
ClientSocket->ReceiveMessageSignal.connect(OnReceiveMessage());
ClientSocket->ReceiveMapSignal.connect(boost::bind(&OnRecieveMapUpdate, _1));
ClientSocket->ReceiveAlarmMapSignal.connect(boost::bind(&OnRecieveAlarmMapUpdate, _1));
ClientSocket->Open(std::string(addr_c), std::string(port_c));
IoServiceThread = boost::thread(boost::bind(&IoServiceRun));
//WriteToFile("Thread go\n");
connection_mutex.lock();
connection_mutex.unlock();
//WriteToFile("Sleep over\n");
jclass cls = env->FindClass("fishrungames/kobserver/JniWrapper");
jmethodID mid = env->GetStaticMethodID(cls, "OnConnectSuccessful", "()V");
clazzLUSCore = (_jclass*)env->NewGlobalRef(cls);
env->DeleteLocalRef(cls);
if (mid == NULL)
{
return;
}
env->CallStaticVoidMethod(cls, mid);
env->ReleaseStringUTFChars(addr, addr_c);
env->ReleaseStringUTFChars(port, port_c);
}
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_Close(JNIEnv * env, jobject obj)
{
ClientSocket->CloseThreaded();
}
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_UpdateUserInfo(JNIEnv * env, jobject obj
, jstring lastName
, jstring firstName
, jstring middleName
, jstring contactNumber
, int mapState
, int uik
, int status
, float posX
, float posY)
{
TUserInfo userInfo;
const char *c_lastName;
c_lastName = env->GetStringUTFChars(lastName, NULL);
if (c_lastName == NULL)
{
return;
}
userInfo.LastName = std::string(c_lastName);
env->ReleaseStringUTFChars(lastName, c_lastName);
// ==== First Name
const char *c_firstName;
c_firstName = env->GetStringUTFChars(firstName, NULL);
if (c_firstName == NULL)
{
return;
}
userInfo.FirstName = std::string(c_firstName);
env->ReleaseStringUTFChars(firstName, c_firstName);
// ==== Middle Name
const char *c_middleName;
c_middleName = env->GetStringUTFChars(middleName, NULL);
if (c_middleName == NULL)
{
return;
}
userInfo.MiddleName = std::string(c_middleName);
env->ReleaseStringUTFChars(middleName, c_middleName);
// ==== Contact Number
const char *c_contactNumber;
c_contactNumber = env->GetStringUTFChars(contactNumber, NULL);
if (c_contactNumber == NULL)
{
return;
}
userInfo.PhoneNumber = std::string(c_contactNumber);
env->ReleaseStringUTFChars(contactNumber, c_contactNumber);
userInfo.MapState = mapState;
userInfo.Uik = uik;
userInfo.Status = status;
userInfo.PosX = posX;
userInfo.PosY = posY;
ClientSocket->UserInfo = userInfo;
ClientSocket->SendUserinfoUpdateThreaded();
}
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_SetAlarmCommon(JNIEnv * env, jobject obj)
{
ClientSocket->UserInfo.MapState = 2;
ClientSocket->SendUserinfoUpdateThreaded();
ClientSocket->SendMessageThreaded(std::string("ТРЕВОГА (АВТОМАТИЧЕСКОЕ СООБЩЕНИЕ)"));
}
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_SetAlarmExclusion(JNIEnv * env, jobject obj)
{
ClientSocket->UserInfo.MapState = 3;
ClientSocket->SendUserinfoUpdateThreaded();
ClientSocket->SendMessageThreaded(std::string("ТРЕВОГА: УДАЛЕНИЕ С УИК (АВТОМАТИЧЕСКОЕ СООБЩЕНИЕ)"));
}
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_SetAlarmInjection(JNIEnv * env, jobject obj)
{
ClientSocket->UserInfo.MapState = 4;
ClientSocket->SendUserinfoUpdateThreaded();
ClientSocket->SendMessageThreaded(std::string("ТРЕВОГА: ВБРОС (АВТОМАТИЧЕСКОЕ СООБЩЕНИЕ)"));
}
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_SetAlarmCarousel(JNIEnv * env, jobject obj)
{
ClientSocket->UserInfo.MapState = 5;
ClientSocket->SendUserinfoUpdateThreaded();
ClientSocket->SendMessageThreaded(std::string("ТРЕВОГА: КАРУСЕЛЬ (АВТОМАТИЧЕСКОЕ СООБЩЕНИЕ)"));
}
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_SetAlarmAssault(JNIEnv * env, jobject obj)
{
ClientSocket->UserInfo.MapState = 6;
ClientSocket->SendUserinfoUpdateThreaded();
ClientSocket->SendMessageThreaded(std::string("ТРЕВОГА: НАПАДЕНИЕ (АВТОМАТИЧЕСКОЕ СООБЩЕНИЕ)"));
}
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_SendMessage(JNIEnv * env, jobject obj, jstring msg)
{
const char *c_msg;
c_msg = env->GetStringUTFChars(msg, NULL);
if (c_msg == NULL)
{
return;
}
std::string str_msg(c_msg);
env->ReleaseStringUTFChars(msg, c_msg);
ClientSocket->SendMessageThreaded(str_msg);
}
JNIEXPORT jstring JNICALL Java_fishrungames_kobserver_JniWrapper_GetLastMessageHeader(JNIEnv * env, jobject obj)
{
jstring jstr;
if (MessageHeaderArr.size() > 0)
{
JavaStringHolder.push_back(MessageHeaderArr[0]);
jstr = env->NewStringUTF(JavaStringHolder[JavaStringHolder.size()-1].c_str());
MessageHeaderArr.clear();
}
else
{
jstr = env->NewStringUTF("");
}
return jstr;
}
JNIEXPORT jstring JNICALL Java_fishrungames_kobserver_JniWrapper_GetLastMessageText(JNIEnv * env, jobject obj)
{
jstring jstr;
if (MessageTextArr.size() > 0)
{
JavaStringHolder.push_back(MessageTextArr[0]);
jstr = env->NewStringUTF(JavaStringHolder[JavaStringHolder.size()-1].c_str());
MessageTextArr.clear();
}
else
{
jstr = env->NewStringUTF("");
}
return jstr;
}
JNIEXPORT int JNICALL Java_fishrungames_kobserver_JniWrapper_GetNumberOfUsers(JNIEnv * env, jobject obj)
{
return (*CurrentUserInfoMapArr).size();
}
JNIEXPORT int JNICALL Java_fishrungames_kobserver_JniWrapper_GetUserUik(JNIEnv * env, jobject obj, int i)
{
return (*CurrentUserInfoMapArr)[i].Uik;
}
JNIEXPORT float JNICALL Java_fishrungames_kobserver_JniWrapper_GetUserPosX(JNIEnv * env, jobject obj, int i)
{
return (*CurrentUserInfoMapArr)[i].PosX;
}
JNIEXPORT float JNICALL Java_fishrungames_kobserver_JniWrapper_GetUserPosY(JNIEnv * env, jobject obj, int i)
{
return (*CurrentUserInfoMapArr)[i].PosY;
}
JNIEXPORT int JNICALL Java_fishrungames_kobserver_JniWrapper_GetUserMapState(JNIEnv * env, jobject obj, int i)
{
return (*CurrentUserInfoMapArr)[i].MapState;
}
JNIEXPORT jstring JNICALL Java_fishrungames_kobserver_JniWrapper_GetUserDescription(JNIEnv * env, jobject obj, int i)
{
std::string State;
if ((*CurrentUserInfoMapArr)[i].MapState == 2)
{
State = "Тревога";
}
else if ((*CurrentUserInfoMapArr)[i].MapState == 3)
{
State = "Тревога - Удаление с УИК";
}
else if ((*CurrentUserInfoMapArr)[i].MapState == 4)
{
State = "Тревога - Вброс";
}
else if ((*CurrentUserInfoMapArr)[i].MapState == 5)
{
State = "Тревога - Карусель";
}
else if ((*CurrentUserInfoMapArr)[i].MapState == 6)
{
State = "Тревога - Нападение";
}
std::string status = "Наблюдатель";
if ((*CurrentUserInfoMapArr)[i].Status == 1)
{
status = "Мобильная группа";
}
std::string descr = "УИК №" + tostr((*CurrentUserInfoMapArr)[i].Uik) + "\\n"+
(*CurrentUserInfoMapArr)[i].LastName+ "\\n"+
(*CurrentUserInfoMapArr)[i].FirstName+ "\\n"+
(*CurrentUserInfoMapArr)[i].MiddleName+ "\\n"+
(*CurrentUserInfoMapArr)[i].PhoneNumber+ "\\n"+
status + "\\n" +
"Состояние: "+State;
jstring jstr;
jstr = env->NewStringUTF(descr.c_str());
return jstr;
}
JNIEXPORT float JNICALL Java_fishrungames_kobserver_JniWrapper_GetMapCenterPosX(JNIEnv * env, jobject obj)
{
return ClientSocket->BaseLon;
}
JNIEXPORT float JNICALL Java_fishrungames_kobserver_JniWrapper_GetMapCenterPosY(JNIEnv * env, jobject obj)
{
return ClientSocket->BaseLat;
}
JNIEXPORT int JNICALL Java_fishrungames_kobserver_JniWrapper_GetMapCenterZoom(JNIEnv * env, jobject obj)
{
return ClientSocket->BaseZoom;
}
JNIEXPORT int JNICALL Java_fishrungames_kobserver_JniWrapper_SetPosition(JNIEnv * env, jobject obj, float x, float y)
{
ClientSocket->UserInfo.PosX = x;
ClientSocket->UserInfo.PosY = y;
LastPosX = x;
LastPosY = y;
}
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_ChangeMapType(JNIEnv * env, jobject obj, int mapType)
{
MapType = mapType;
if (MapType == 0)
{
CurrentUserInfoMapArr = &UserInfoMapArr;
}
else
{
CurrentUserInfoMapArr = &UserInfoAlarmMapArr;
}
}

View File

@ -0,0 +1,65 @@
#ifndef ANDROID_API_H_INCLUDED
#define ANDROID_API_H_INCLUDED
#include <jni.h>
#include <android/log.h>
#include <GLES/gl.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include "boost/shared_ptr.hpp"
#include "main_code.h"
void RestartHeartbeatTimer();
void RestartMapHeartbeatTimer();
extern "C" {
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_Open(JNIEnv * env, jobject obj, jstring addr, jstring port);
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_Close(JNIEnv * env, jobject obj);
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_UpdateUserInfo(JNIEnv * env, jobject obj
, jstring lastName
, jstring firstName
, jstring middleName
, jstring contactNumber
, int mapState
, int uik
, int status
, float posX
, float posY);
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_SetAlarmCommon(JNIEnv * env, jobject obj);
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_SetAlarmExclusion(JNIEnv * env, jobject obj);
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_SetAlarmInjection(JNIEnv * env, jobject obj);
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_SetAlarmCarousel(JNIEnv * env, jobject obj);
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_SetAlarmAssault(JNIEnv * env, jobject obj);
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_SendMessage(JNIEnv * env, jobject obj, jstring msg);
JNIEXPORT jstring JNICALL Java_fishrungames_kobserver_JniWrapper_GetLastMessageHeader(JNIEnv * env, jobject obj);
JNIEXPORT jstring JNICALL Java_fishrungames_kobserver_JniWrapper_GetLastMessageText(JNIEnv * env, jobject obj);
JNIEXPORT int JNICALL Java_fishrungames_kobserver_JniWrapper_GetNumberOfUsers(JNIEnv * env, jobject obj);
JNIEXPORT int JNICALL Java_fishrungames_kobserver_JniWrapper_GetUserUik(JNIEnv * env, jobject obj, int i);
JNIEXPORT float JNICALL Java_fishrungames_kobserver_JniWrapper_GetUserPosX(JNIEnv * env, jobject obj, int i);
JNIEXPORT float JNICALL Java_fishrungames_kobserver_JniWrapper_GetUserPosY(JNIEnv * env, jobject obj, int i);
JNIEXPORT int JNICALL Java_fishrungames_kobserver_JniWrapper_GetUserMapState(JNIEnv * env, jobject obj, int i);
JNIEXPORT jstring JNICALL Java_fishrungames_kobserver_JniWrapper_GetUserDescription(JNIEnv * env, jobject obj, int i);
JNIEXPORT float JNICALL Java_fishrungames_kobserver_JniWrapper_GetMapCenterPosX(JNIEnv * env, jobject obj);
JNIEXPORT float JNICALL Java_fishrungames_kobserver_JniWrapper_GetMapCenterPosY(JNIEnv * env, jobject obj);
JNIEXPORT int JNICALL Java_fishrungames_kobserver_JniWrapper_GetMapCenterZoom(JNIEnv * env, jobject obj);
JNIEXPORT int JNICALL Java_fishrungames_kobserver_JniWrapper_SetPosition(JNIEnv * env, jobject obj, float x, float y);
JNIEXPORT void JNICALL Java_fishrungames_kobserver_JniWrapper_ChangeMapType(JNIEnv * env, jobject obj, int mapType);
};
#endif

View File

@ -0,0 +1,10 @@
#include "main_code.h"
#include "android_api.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>

View File

@ -0,0 +1,16 @@
#ifndef GL_CODE_H_INCLUDED
#define GL_CODE_H_INCLUDED
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "boost/shared_ptr.hpp"
#include "boost/thread/thread.hpp"
#include "boost/signal.hpp"
#include "boost/assign.hpp"
#include "boost/bind.hpp"
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout1" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:orientation="vertical" android:layout_width="wrap_content" android:weightSum="1" android:background="@color/alarm">
<RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="320dp" android:layout_height="wrap_content">
<TextView android:id="@+id/textView1" android:text="К-Выборы" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:textColor="@color/black"></TextView>
<TextView android:id="@+id/textView2" android:text="Включен режим тревоги." android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_below="@+id/textView1" android:layout_centerHorizontal="true" android:textColor="@color/black"></TextView>
<TextView android:id="@+id/textView4" android:text="Что случилось?" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_below="@+id/textView2" android:layout_centerHorizontal="true" android:textColor="@color/black"></TextView>
<Button android:layout_height="wrap_content" android:text="Назад" android:id="@+id/backButton_alarm" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentLeft="true"></Button>
</RelativeLayout>
<RelativeLayout android:id="@+id/relativeLayout2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0.25">
<Button android:layout_height="wrap_content" android:text="Удаление с участка" android:id="@+id/exclusionButton" android:layout_centerVertical="true" android:layout_centerHorizontal="true" android:layout_width="220dp"></Button>
</RelativeLayout>
<RelativeLayout android:id="@+id/relativeLayout3" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0.25">
<Button android:layout_height="wrap_content" android:text="Вброс" android:id="@+id/injectionButton" android:layout_centerVertical="true" android:layout_centerHorizontal="true" android:layout_width="220dp"></Button>
</RelativeLayout>
<RelativeLayout android:id="@+id/relativeLayout4" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0.25">
<Button android:layout_height="wrap_content" android:text="Карусель" android:id="@+id/carouselButton" android:layout_centerVertical="true" android:layout_centerHorizontal="true" android:layout_width="220dp"></Button>
</RelativeLayout>
<RelativeLayout android:id="@+id/relativeLayout5" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="0.25">
<Button android:layout_height="wrap_content" android:text="Нападение" android:id="@+id/assaultButton" android:layout_centerVertical="true" android:layout_centerHorizontal="true" android:layout_width="220dp"></Button>
</RelativeLayout>
<RelativeLayout android:layout_height="wrap_content" android:id="@+id/relativeLayout6" android:layout_width="match_parent" android:layout_weight="0.57">
<EditText android:id="@+id/additionalMessageEdit" android:layout_below="@+id/textView3" android:layout_centerHorizontal="true" android:layout_width="300dp" android:layout_height="110dp" android:gravity="top"></EditText>
<Button android:layout_height="wrap_content" android:text="Отправить" android:id="@+id/sendAdditionalMessageButton" android:layout_below="@+id/additionalMessageEdit" android:layout_centerHorizontal="true" android:layout_width="160dp"></Button>
<TextView android:id="@+id/textView3" android:text="Дополнительное сообщение: " android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:textColor="@color/black"></TextView>
</RelativeLayout>
<LinearLayout android:layout_weight="0.06" android:id="@+id/linearLayout2" android:layout_width="20dp" android:orientation="vertical" android:layout_height="20dp"></LinearLayout>
</LinearLayout>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout1" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:orientation="vertical" android:layout_width="wrap_content" android:weightSum="1" android:background="@color/black">
<RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="320dp" android:layout_height="wrap_content" android:layout_weight="0.06">
<TextView android:id="@+id/textView1" android:text="К-Выборы" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true"></TextView>
<TextView android:id="@+id/textView2" android:text="Введите адрес сервера" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_below="@+id/textView1" android:layout_centerHorizontal="true"></TextView>
</RelativeLayout>
<RelativeLayout android:layout_height="wrap_content" android:id="@+id/relativeLayout2" android:layout_width="match_parent" android:layout_weight="0.17">
<EditText android:text="k-observer.org" android:ellipsize="end" android:layout_height="wrap_content" android:id="@+id/edit_addr" android:singleLine="true" android:layout_width="200dp" android:layout_centerVertical="true" android:layout_alignParentLeft="true" android:layout_marginLeft="20dp"></EditText>
<EditText android:text="1984" android:ellipsize="end" android:layout_height="wrap_content" android:id="@+id/edit_port" android:singleLine="true" android:layout_width="80dp" android:layout_alignBaseline="@+id/edit_addr" android:layout_alignBottom="@+id/edit_addr" android:layout_toRightOf="@+id/edit_addr">
<requestFocus></requestFocus>
</EditText>
<TextView android:id="@+id/textView3" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Адрес:" android:layout_above="@+id/editText1" android:layout_alignLeft="@+id/edit_addr"></TextView>
<TextView android:id="@+id/textView4" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Порт:" android:layout_above="@+id/editText1" android:layout_toRightOf="@+id/edit_addr"></TextView>
</RelativeLayout>
<RelativeLayout android:layout_height="wrap_content" android:id="@+id/relativeLayout3" android:layout_width="match_parent" android:layout_weight="0.14">
<Button android:layout_height="wrap_content" android:text="Подключиться" android:id="@+id/connectButton" android:layout_centerVertical="true" android:layout_centerHorizontal="true" android:layout_width="180dp"></Button>
</RelativeLayout>
</LinearLayout>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout1" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:orientation="vertical" android:layout_width="wrap_content" android:weightSum="1" android:background="@color/black">
<RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="320dp" android:layout_height="wrap_content" android:layout_weight="0.15">
<TextView android:id="@+id/textView1" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="К-Выборы" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_alignParentTop="true" android:layout_centerHorizontal="true"></TextView>
<TextView android:id="@+id/textView2" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Выберите действие" android:layout_below="@+id/textView1" android:layout_centerHorizontal="true"></TextView>
<Button android:text="Назад" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/disconnectButton" android:layout_alignParentTop="true" android:layout_alignParentLeft="true"></Button>
</RelativeLayout>
<RelativeLayout android:layout_height="wrap_content" android:id="@+id/relativeLayout2" android:layout_width="match_parent" android:layout_weight="0.10">
<Button android:layout_height="wrap_content" android:text="Открыть карту" android:id="@+id/mapButton" android:layout_centerVertical="true" android:layout_centerHorizontal="true" android:layout_width="220dp"></Button>
</RelativeLayout>
<RelativeLayout android:layout_height="wrap_content" android:id="@+id/relativeLayout3" android:layout_width="match_parent" android:layout_weight="0.11">
<Button android:layout_height="wrap_content" android:text="Изменить профиль" android:id="@+id/profileButton" android:layout_centerVertical="true" android:layout_centerHorizontal="true" android:layout_width="220dp"></Button>
</RelativeLayout>
<RelativeLayout android:layout_height="wrap_content" android:id="@+id/relativeLayout4" android:layout_width="match_parent" android:layout_weight="0.11">
<Button android:layout_height="wrap_content" android:text="Подать сигнал тревоги" android:id="@+id/alarmButton" android:layout_centerVertical="true" android:layout_centerHorizontal="true" android:layout_width="220dp"></Button>
</RelativeLayout>
<RelativeLayout android:layout_height="wrap_content" android:id="@+id/relativeLayout5" android:layout_width="match_parent" android:layout_weight="0.08">
<Button android:layout_height="wrap_content" android:text="Посмотреть сообщения" android:id="@+id/messagesButton" android:layout_centerVertical="true" android:layout_centerHorizontal="true" android:layout_width="220dp"></Button>
</RelativeLayout>
</LinearLayout>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout1" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:orientation="vertical" android:layout_width="wrap_content" android:weightSum="1" android:background="@color/black">
<RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="320dp" android:layout_height="wrap_content" android:layout_weight="0.06">
<TextView android:id="@+id/textView1" android:text="К-Выборы" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true"></TextView>
<TextView android:id="@+id/textView2" android:text="Карта" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_below="@+id/textView1" android:layout_centerHorizontal="true"></TextView>
<Button android:layout_height="wrap_content" android:text="Назад" android:id="@+id/backButton_map" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentLeft="true"></Button>
</RelativeLayout>
<RelativeLayout android:layout_height="wrap_content" android:id="@+id/relativeLayout2" android:layout_width="match_parent" android:layout_weight="0.05">
<WebView android:layout_width="match_parent" android:id="@+id/webView" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_height="380dp"></WebView>
</RelativeLayout>
<RelativeLayout android:layout_height="wrap_content" android:id="@+id/relativeLayout3" android:layout_width="match_parent" android:layout_weight="0.14">
</RelativeLayout>
<Spinner android:layout_height="wrap_content" android:id="@+id/mapModeSpinner" android:layout_width="match_parent" android:layout_weight="0.06"></Spinner>
</LinearLayout>

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout1" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:orientation="vertical" android:layout_width="wrap_content" android:weightSum="1" android:background="@color/black">
<RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="320dp" android:layout_weight="0.06" android:layout_height="50dp">
<TextView android:id="@+id/textView1" android:text="К-Выборы" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true"></TextView>
<TextView android:id="@+id/textView2" android:text="Сообщения" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_below="@+id/textView1" android:layout_centerHorizontal="true"></TextView>
<Button android:layout_height="wrap_content" android:text="Отправить" android:id="@+id/sendMessageButton" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentRight="true"></Button>
<Button android:layout_height="wrap_content" android:text="Назад" android:id="@+id/backButton_messages" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentLeft="true"></Button>
</RelativeLayout>
<RelativeLayout android:id="@+id/relativeLayout2" android:layout_width="match_parent" android:layout_weight="0.68" android:layout_height="180dp">
<EditText
android:layout_height="match_parent"
android:inputType="textMultiLine"
android:id="@+id/currentMessageEdit"
android:layout_width="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:gravity="top">
</EditText>
</RelativeLayout>
<RelativeLayout android:layout_height="wrap_content" android:id="@+id/relativeLayout3" android:layout_weight="0.49" android:layout_width="match_parent">
<ListView android:layout_width="match_parent" android:id="@+id/messageListView2" android:layout_height="186dp"></ListView>
</RelativeLayout>
</LinearLayout>

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout1" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:orientation="vertical" android:layout_width="wrap_content" android:weightSum="1" android:background="@color/black">
<ScrollView android:layout_width="wrap_content" android:id="@+id/scrollView1" android:layout_height="wrap_content" android:layout_alignParentTop="true" android:layout_alignLeft="@+id/textView1">
<LinearLayout android:id="@+id/linearLayout_2" android:layout_width="match_parent" android:orientation="vertical" android:layout_height="600dp">
<RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="320dp" android:layout_height="wrap_content">
<TextView android:id="@+id/textView1" android:text="К-Выборы" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true"></TextView>
<TextView android:id="@+id/textView2" android:text="Профиль пользователя" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_below="@+id/textView1" android:layout_centerHorizontal="true"></TextView>
<Button android:layout_height="wrap_content" android:text="Назад" android:id="@+id/backButton_profile" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentLeft="true"></Button>
</RelativeLayout>
<RelativeLayout android:id="@+id/RelativeLayout1" android:layout_width="match_parent" android:orientation="vertical" android:layout_height="wrap_content">
<CheckBox android:layout_alignParentLeft="true" android:layout_below="@+id/textView8" android:layout_height="wrap_content" android:id="@+id/alarmCheckBox" android:text="Режим тревоги" android:layout_width="206dp"></CheckBox>
<EditText android:layout_height="wrap_content" android:id="@+id/lastNameEdit" android:layout_below="@+id/textView3" android:layout_centerHorizontal="true" android:layout_width="280dp" android:ellipsize="end" android:singleLine="true">
<requestFocus></requestFocus>
</EditText>
<EditText android:layout_height="wrap_content" android:id="@+id/firstNameEdit" android:layout_width="280dp" android:layout_below="@+id/textView4" android:layout_centerHorizontal="true" android:ellipsize="end" android:singleLine="true">
</EditText>
<EditText android:layout_height="wrap_content" android:id="@+id/middleNameEdit" android:layout_below="@+id/textView5" android:layout_centerHorizontal="true" android:layout_width="280dp" android:ellipsize="end" android:singleLine="true"></EditText>
<EditText android:layout_height="wrap_content" android:id="@+id/contactNumberEdit" android:layout_below="@+id/textView6" android:layout_centerHorizontal="true" android:layout_width="280dp" android:ellipsize="end" android:singleLine="true"></EditText>
<Spinner android:id="@+id/statusSpinner" android:layout_height="wrap_content" android:layout_below="@+id/textView7" android:layout_centerHorizontal="true" android:layout_width="280dp"></Spinner>
<TextView android:id="@+id/textView3" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Фамилия:" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" android:layout_marginTop="20dp"></TextView>
<TextView android:id="@+id/textView4" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Имя:" android:layout_below="@+id/lastNameEdit" android:layout_alignParentLeft="true" android:layout_marginTop="20dp"></TextView>
<TextView android:id="@+id/textView5" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Отчество:" android:layout_below="@+id/firstNameEdit" android:layout_alignParentLeft="true" android:layout_marginTop="20dp"></TextView>
<TextView android:id="@+id/textView6" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Контактный телефон:" android:layout_below="@+id/middleNameEdit" android:layout_alignParentLeft="true" android:layout_marginTop="20dp"></TextView>
<TextView android:id="@+id/textView7" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Статус:" android:layout_below="@+id/uikNumberEdit" android:layout_alignParentLeft="true" android:layout_marginTop="20dp"></TextView>
<TextView android:id="@+id/textView8" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="Режим тревоги:" android:layout_below="@+id/statusSpinner" android:layout_alignParentLeft="true" android:layout_marginTop="20dp"></TextView>
<TextView android:id="@+id/textView9" android:layout_height="wrap_content" android:text="Номер УИК" android:layout_width="wrap_content" android:layout_below="@+id/contactNumberEdit" android:layout_alignParentLeft="true" android:layout_marginTop="20dp"></TextView>
<EditText android:id="@+id/uikNumberEdit" android:layout_height="wrap_content" android:inputType="number" android:layout_width="280dp" android:layout_alignTop="@+id/textView9" android:layout_marginTop="20dp" android:layout_centerHorizontal="true"></EditText>
</RelativeLayout>
<RelativeLayout android:id="@+id/relativeLayout2" android:layout_width="match_parent" android:layout_height="match_parent">
<Button android:layout_height="wrap_content" android:text="Обновить" android:id="@+id/updateUserinfoButton" android:layout_centerVertical="true" android:layout_centerHorizontal="true" android:layout_width="180dp" android:layout_marginTop="20dp"></Button>
</RelativeLayout>
</LinearLayout>
</ScrollView>
</LinearLayout>

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout1" xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent"
android:orientation="vertical" android:layout_width="wrap_content" android:weightSum="1" android:background="@color/black">
<RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="320dp" android:layout_height="wrap_content" android:layout_weight="0.06">
<TextView android:id="@+id/textView1" android:text="К-Выборы" android:textAppearance="?android:attr/textAppearanceLarge" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_centerHorizontal="true"></TextView>
<TextView android:id="@+id/textView2" android:text="Введите сообщение" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_below="@+id/textView1" android:layout_centerHorizontal="true"></TextView>
<Button android:layout_height="wrap_content" android:text="Отправить" android:id="@+id/sendMessageButton" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentRight="true"></Button>
<Button android:layout_height="wrap_content" android:text="Назад" android:id="@+id/backButton_send_message" android:layout_width="wrap_content" android:layout_alignParentTop="true" android:layout_alignParentLeft="true"></Button>
</RelativeLayout>
<RelativeLayout android:layout_height="wrap_content" android:id="@+id/relativeLayout5" android:layout_width="match_parent" android:layout_weight="0.81">
<EditText android:id="@+id/messageEdit" android:inputType="textMultiLine" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:layout_width="match_parent" android:layout_height="200dp" android:gravity="top">
<requestFocus></requestFocus>
</EditText>
</RelativeLayout>
</LinearLayout>

View File

@ -0,0 +1,117 @@
<!DOCTYPE HTML>
<title>OpenLayers Simplest Example</title>
<div id="demoMap" style="height:360px"></div>
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script>
map = new OpenLayers.Map("demoMap");
var mapnik = new OpenLayers.Layer.OSM();
var fromProjection = new OpenLayers.Projection("EPSG:4326");
var toProjection = new OpenLayers.Projection("EPSG:900913");
var position = new OpenLayers.LonLat(__LON__, __LAT__).transform( fromProjection, toProjection);
var zoom = __ZOOM__;
map.addLayer(mapnik);
map.setCenter(position, zoom );
var markers = new OpenLayers.Layer.Markers( "Markers" );
map.addLayer(markers);
selectControl = new OpenLayers.Control.SelectFeature(markers);
map.addControl(selectControl);
function AddMarker(x, y, state)
{
if (state == 0)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_mobile.png";
}
else if (state == 1)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker.png";
}
else
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_alarm.png";
}
var size = new OpenLayers.Size(21,25);
var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
var icon = new OpenLayers.Icon(marker_addr, size, offset);
var lon_Lat = new OpenLayers.LonLat(x, y).transform(fromProjection, toProjection);
markers.addMarker(new OpenLayers.Marker(lon_Lat, icon));
}
function ActivateSelectControl()
{
selectControl.activate();
}
function DeactivateSelectControl()
{
selectControl.deactivate();
}
function Clear()
{
markers.clearMarkers();
}
function AddMarkerWithPopup(x, y, state, text)
{
if (state == 0)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_mobile.png";
}
else if (state == 1)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker.png";
}
else if (state == 2)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_alarm.png";
}
else if (state == 3)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_exclusion.png";
}
else if (state == 4)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_throw.png";
}
else if (state == 5)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_carousel.png";
}
else if (state == 6)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_assault.png";
}
else
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_alarm.png";
}
var size = new OpenLayers.Size(21,25);
var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
var icon = new OpenLayers.Icon(marker_addr, size, offset);
var lon_Lat = new OpenLayers.LonLat(x, y).transform(fromProjection, toProjection);
var marker = new OpenLayers.Marker(lon_Lat, icon);
marker.events.register('mousedown', marker, function(evt) { alert(text); OpenLayers.Event.stop(evt); });
markers.addMarker(marker);
}
</script>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="default_color">#ff8080ff</color>
<color name="alarm">#ffffe080</color>
<color name="black">#ff000000</color>
<color name="white">#ffffffff</color>
</resources>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">AndroidJniTemplate</string>
</resources>

View File

@ -0,0 +1,102 @@
package fishrungames.kobserver;
import fishrungames.kobserver.JniWrapper;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class AlarmActivity extends Activity
{
@Override
protected void onCreate(Bundle icicle)
{
super.onCreate(icicle);
setContentView(R.layout.alarm_layout);
Button backbtn = (Button) findViewById(R.id.backButton_alarm);
backbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), MainMenuActivity.class);
startActivityForResult(myIntent, 0);
}
});
Button exclusionButton = (Button) findViewById(R.id.exclusionButton);
exclusionButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
JniWrapper.MapState = 3;
JniWrapper.SetAlarmExclusion();
}
});
Button injectionButton = (Button) findViewById(R.id.injectionButton);
injectionButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
JniWrapper.MapState = 4;
JniWrapper.SetAlarmInjection();
}
});
Button carouselButton = (Button) findViewById(R.id.carouselButton);
carouselButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
JniWrapper.MapState = 5;
JniWrapper.SetAlarmCarousel();
}
});
Button assaultButton = (Button) findViewById(R.id.assaultButton);
assaultButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
JniWrapper.MapState = 6;
JniWrapper.SetAlarmAssault();
}
});
Button sendAdditionalMessageButton = (Button) findViewById(R.id.sendAdditionalMessageButton);
sendAdditionalMessageButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
EditText additionalMessageEdit = (EditText) findViewById(R.id.additionalMessageEdit);
JniWrapper.SendMessage(additionalMessageEdit.getText().toString());
additionalMessageEdit.setText("");
}
});
}
}

View File

@ -0,0 +1,56 @@
package fishrungames.kobserver;
import fishrungames.kobserver.JniWrapper;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class ConnectActivity extends Activity
{
@Override
protected void onCreate(Bundle icicle)
{
super.onCreate(icicle);
setContentView(R.layout.connect_layout);
JniWrapper.connectActivity = this;
Button connectbtn = (Button) findViewById(R.id.connectButton);
connectbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
EditText addr_edit = (EditText) findViewById(R.id.edit_addr);
EditText port_edit = (EditText) findViewById(R.id.edit_port);
JniWrapper.Open(addr_edit.getText().toString(), port_edit.getText().toString());
JniWrapper.StartGetMessageTimer();
}
});
if (JniWrapper.connected)
{
goToMainMenu();
}
}
public void goToMainMenu()
{
Intent myIntent = new Intent(this, MainMenuActivity.class);
startActivityForResult(myIntent, 0);
}
}

View File

@ -0,0 +1,30 @@
package fishrungames.kobserver;
import android.location.Location;
import android.location.LocationListener;
import android.os.Bundle;
public class GeoUpdateHandler implements LocationListener {
@Override
public void onLocationChanged(Location location) {
//int lat = (int) (location.getLatitude() * 1E6);
//int lng = (int) (location.getLongitude() * 1E6);
// GeoPoint point = new GeoPoint(lat, lng);
//mapController.animateTo(point);
float lat = (float)location.getLatitude();
float lon = (float)location.getLongitude();
JniWrapper.SetPosition(lon, lat);
}
@Override
public void onProviderDisabled(String provider) { }
@Override
public void onProviderEnabled(String provider) { }
@Override
public void onStatusChanged(String provider, int status, Bundle extras) { }
}

View File

@ -0,0 +1,30 @@
package fishrungames.kobserver;
import java.util.TimerTask;
import fishrungames.kobserver.JniWrapper;
class GetMessageTimerTask extends TimerTask
{
@Override
public void run()
{
String messageHeader = JniWrapper.GetLastMessageHeader();
String messageText = JniWrapper.GetLastMessageText();
if (!messageHeader.equals("") && !messageText.equals(""))
{
JniWrapper.messages_headers.add(0, messageHeader);
JniWrapper.messages_texts.add(0, messageText);
if (JniWrapper.messagesActivity != null)
{
JniWrapper.messagesActivity.RefreshMessageList();
}
}
}
}

View File

@ -0,0 +1,113 @@
package fishrungames.kobserver;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Timer;
import android.content.Context;
import android.location.LocationManager;
import fishrungames.kobserver.GetMessageTimerTask;
public class JniWrapper
{
static {
System.loadLibrary("KObserver");
}
public static Timer UpdateTimer;
public static MessagesActivity messagesActivity = null;
public static boolean connected = false;
//Info to be saved
public static String LastName = new String();
public static String FirstName = new String();
public static String MiddleName = new String();
public static String ContactNumber = new String();
public static int MapState;
public static int UikNumber;
public static int Status;
public static float PosX;
public static float PosY;
public static ArrayList<String> messages_headers = new ArrayList<String>(Arrays.asList("Ïîäêëþ÷åíèå óñòàíîâëåíî"));
public static ArrayList<String> messages_texts = new ArrayList<String>(Arrays.asList("Ïîäêëþ÷åíèå ê ñåðâåðó óñïåøíî óñòàíîâëåíî"));
public static ConnectActivity connectActivity;
public static native void Open(String addr, String port);
public static native void Close();
public static void OnConnectSuccessful()
{
connectActivity.goToMainMenu();
connected = true;
}
public static native void UpdateUserInfo(String lastName, String firstName, String middleName, String contactNumber, int mapState, int Uik, int Status, float posX, float posY);
public static native void SetAlarmCommon();
public static native void SetAlarmExclusion();
public static native void SetAlarmInjection();
public static native void SetAlarmCarousel();
public static native void SetAlarmAssault();
public static native void SendMessage(String msg);
public static native String GetLastMessageHeader();
public static native String GetLastMessageText();
public static native int GetNumberOfUsers();
public static native int GetUserUik(int i);
public static native float GetUserPosX(int i);
public static native float GetUserPosY(int i);
public static native int GetUserMapState(int i);
public static native String GetUserDescription(int i);
public static native float GetMapCenterPosX();
public static native float GetMapCenterPosY();
public static native int GetMapCenterZoom();
public static native float SetPosition(float x, float y);
public static native void ChangeMapType(int mapType);
public static void StartGetMessageTimer()
{
UpdateTimer = new Timer();
UpdateTimer.schedule(new GetMessageTimerTask(), 0, 100);
}
public static void StopGetMessageTimer()
{
UpdateTimer = null;
}
public static LocationManager locationManager = null;
public static void StartUpdateMapLocation(MainMenuActivity act)
{
locationManager = (LocationManager) act.getSystemService(Context.LOCATION_SERVICE);
//Use both =)
//locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, new GeoUpdateHandler());
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, new GeoUpdateHandler());
}
}

View File

@ -0,0 +1,80 @@
package fishrungames.kobserver;
import fishrungames.kobserver.JniWrapper;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
public class MainMenuActivity extends Activity
{
@Override
protected void onCreate(Bundle icicle)
{
super.onCreate(icicle);
//setContentView(R.layout.connect_layout);
setContentView(R.layout.main_menu_layout);
JniWrapper.StartUpdateMapLocation(this);
Button mapbtn = (Button) findViewById(R.id.mapButton);
mapbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), MapActivity.class);
startActivityForResult(myIntent, 0);
}
});
Button profilebtn = (Button) findViewById(R.id.profileButton);
profilebtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), ProfileActivity.class);
startActivityForResult(myIntent, 0);
}
});
Button alarmbtn = (Button) findViewById(R.id.alarmButton);
alarmbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), AlarmActivity.class);
startActivityForResult(myIntent, 0);
JniWrapper.MapState = 2;
JniWrapper.SetAlarmCommon();
}
});
Button messagesbtn = (Button) findViewById(R.id.messagesButton);
messagesbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), MessagesActivity.class);
startActivityForResult(myIntent, 0);
}
});
Button backbtn = (Button) findViewById(R.id.disconnectButton);
backbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
JniWrapper.Close();
JniWrapper.connected = false;
JniWrapper.StopGetMessageTimer();
Intent myIntent = new Intent(view.getContext(), ConnectActivity.class);
startActivityForResult(myIntent, 0);
}
});
}
}

View File

@ -0,0 +1,168 @@
package fishrungames.kobserver;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Timer;
import java.util.TimerTask;
import fishrungames.kobserver.JniWrapper;
import android.app.Activity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemSelectedListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
public class MapActivity extends Activity
{
ArrayAdapter<String> spinnerAdapter;
public Timer mapUpdateTimer;
@Override
protected void onCreate(Bundle icicle)
{
super.onCreate(icicle);
setContentView(R.layout.map_layout);
Button backbtn = (Button) findViewById(R.id.backButton_map);
backbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), MainMenuActivity.class);
startActivityForResult(myIntent, 0);
}
});
Spinner mapModeSpinner = (Spinner) findViewById(R.id.mapModeSpinner);
ArrayList<String> strings =
new ArrayList<String>(Arrays.asList("Îáùàÿ êàðòà", "Êàðòà òðåâîãè"));
spinnerAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, strings);
mapModeSpinner.setAdapter(spinnerAdapter);
WebView webView = (WebView) findViewById(R.id.webView);
mapModeSpinner.setOnItemSelectedListener(new MyOnItemSelectedListener(webView));
String htmlCode = new String();
try {
Resources res = getResources();
InputStream in_s = res.openRawResource(R.raw.script);
byte[] b = new byte[in_s.available()];
in_s.read(b);
htmlCode = new String(b);
} catch (Exception e) {
e.printStackTrace();
}
WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setDomStorageEnabled(true);
webView.setWebChromeClient(new WebChromeClient());
htmlCode = htmlCode.replace("%", "&#37;");
float lon = JniWrapper.GetMapCenterPosX();
float lat = JniWrapper.GetMapCenterPosY();
int zoom = JniWrapper.GetMapCenterZoom();
htmlCode = htmlCode.replace("__LON__", Float.toString(lon));
htmlCode = htmlCode.replace("__LAT__", Float.toString(lat));
htmlCode = htmlCode.replace("__ZOOM__", Integer.toString(zoom));
webView.loadData(htmlCode, "text/html", "UTF-8");
mapUpdateTimer = new Timer();
mapUpdateTimer.schedule(new MapUpdateTimerTask(), 0, 1000);
//webView.loadUrl("javascript:(function() { ActivateSelectControl();})()");
}
public class MyOnItemSelectedListener implements OnItemSelectedListener {
public WebView webView = null;
MyOnItemSelectedListener(WebView selectWebView)
{
webView = selectWebView;
}
public void onItemSelected(AdapterView<?> parent,
View view, int pos, long id) {
if (pos == 0)
{
JniWrapper.ChangeMapType(0);
webView.loadUrl("javascript:(function() { DeactivateSelectControl();})()");
}
else
{
JniWrapper.ChangeMapType(1);
webView.loadUrl("javascript:(function() { ActivateSelectControl();})()");
}
}
public void onNothingSelected(AdapterView<?> parent) {
// Do nothing.
}
}
class MapUpdateTimerTask extends TimerTask
{
@Override
public void run()
{
WebView webView = (WebView) findViewById(R.id.webView);
webView.loadUrl("javascript:(function() { Clear();})()");
int userCount = JniWrapper.GetNumberOfUsers();
for (int i=0; i<userCount; i++)
{
String descr = JniWrapper.GetUserDescription(i);
String code = String.format("javascript:(function() { AddMarkerWithPopup(%f, %f, %d, '%s');})()",
JniWrapper.GetUserPosX(i),
JniWrapper.GetUserPosY(i),
JniWrapper.GetUserMapState(i),
descr);
webView.loadUrl(code);
}
//webView.loadUrl("javascript:(function() { AddMarkerWithPopup(30.2158, 60.0052, 1, 'lolwut');})()");
}
}
}

View File

@ -0,0 +1,93 @@
package fishrungames.kobserver;
import fishrungames.kobserver.JniWrapper;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
public class MessagesActivity extends Activity
{
ArrayAdapter<String> mAdapter;
Handler mHandler = new Handler();
@Override
protected void onCreate(Bundle icicle)
{
JniWrapper.messagesActivity = this;
super.onCreate(icicle);
setContentView(R.layout.messages_layout);
Button backbtn = (Button) findViewById(R.id.backButton_messages);
backbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), MainMenuActivity.class);
startActivityForResult(myIntent, 0);
JniWrapper.messagesActivity = null;
}
});
Button sendmessagebtn = (Button) findViewById(R.id.sendMessageButton);
sendmessagebtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), SendMessageActivity.class);
startActivityForResult(myIntent, 0);
JniWrapper.messagesActivity = null;
}
});
EditText editView = (EditText) findViewById(R.id.currentMessageEdit);
editView.setKeyListener(null);
mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, android.R.id.text1, JniWrapper.messages_headers);
ListView messageListView = (ListView)findViewById(R.id.messageListView2);
messageListView.setAdapter(mAdapter);
messageListView.setOnItemClickListener(new ListView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> a, View v, int i, long l)
{
EditText editView = (EditText) findViewById(R.id.currentMessageEdit);
editView.setText(JniWrapper.messages_texts.get(i));
}
});
}
public void RefreshMessageList()
{
//mAdapter.notifyDataSetChanged();
Runnable TheDelegatedTimerTask= new Runnable() {
@Override public void run() { // function called by main thread when posted message is dequeued
mAdapter.notifyDataSetChanged();
}
};
mHandler.post(TheDelegatedTimerTask);
}
}

View File

@ -0,0 +1,151 @@
package fishrungames.kobserver;
import java.util.ArrayList;
import java.util.Arrays;
import fishrungames.kobserver.JniWrapper;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Spinner;
public class ProfileActivity extends Activity
{
ArrayAdapter<String> spinnerAdapter;
@Override
protected void onCreate(Bundle icicle)
{
super.onCreate(icicle);
setContentView(R.layout.profile_layout);
Button backbtn = (Button) findViewById(R.id.backButton_profile);
backbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), MainMenuActivity.class);
startActivityForResult(myIntent, 0);
}
});
EditText lastNameEdit = (EditText) findViewById(R.id.lastNameEdit);
EditText firstNameEdit = (EditText) findViewById(R.id.firstNameEdit);
EditText middleNameEdit = (EditText) findViewById(R.id.middleNameEdit);
EditText contactNumberEdit = (EditText) findViewById(R.id.contactNumberEdit);
EditText uikNumberEdit = (EditText) findViewById(R.id.uikNumberEdit);
lastNameEdit.setText(JniWrapper.LastName);
firstNameEdit.setText(JniWrapper.FirstName);
middleNameEdit.setText(JniWrapper.MiddleName);
contactNumberEdit.setText(JniWrapper.ContactNumber);
uikNumberEdit.setText(Integer.toString(JniWrapper.UikNumber));
if (JniWrapper.MapState >= 2)
{
CheckBox alarmCheckBox = (CheckBox) findViewById(R.id.alarmCheckBox);
alarmCheckBox.setChecked(true);
}
Spinner statusSpinner = (Spinner) findViewById(R.id.statusSpinner);
ArrayList<String> strings =
new ArrayList<String>(Arrays.asList("Íàáëþäàòåëü", "Ìîáèëüíàÿ ãðóïïà"));
spinnerAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_spinner_item, strings);
statusSpinner.setAdapter(spinnerAdapter);
statusSpinner.setSelection(JniWrapper.Status);
Button updateUserinfoButton = (Button) findViewById(R.id.updateUserinfoButton);
updateUserinfoButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
//Intent myIntent = new Intent(view.getContext(), MainMenuActivity.class);
//startActivityForResult(myIntent, 0);
//LocationManager m = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
EditText lastNameEdit = (EditText) findViewById(R.id.lastNameEdit);
EditText firstNameEdit = (EditText) findViewById(R.id.firstNameEdit);
EditText middleNameEdit = (EditText) findViewById(R.id.middleNameEdit);
EditText contactNumberEdit = (EditText) findViewById(R.id.contactNumberEdit);
EditText uikNumberEdit = (EditText) findViewById(R.id.uikNumberEdit);
Spinner statusSpinner = (Spinner) findViewById(R.id.statusSpinner);
int mapState;
int status = statusSpinner.getSelectedItemPosition();
if (status == 1)
{
mapState = 0;
}
else
{
CheckBox alarmCheckBox = (CheckBox) findViewById(R.id.alarmCheckBox);
if (alarmCheckBox.isChecked())
{
mapState = 2;
}
else
{
mapState = 1;
}
}
JniWrapper.LastName = lastNameEdit.getText().toString();
JniWrapper.FirstName = firstNameEdit.getText().toString();
JniWrapper.MiddleName = middleNameEdit.getText().toString();
JniWrapper.ContactNumber = contactNumberEdit.getText().toString();
JniWrapper.MapState = mapState;
JniWrapper.UikNumber = Integer.parseInt(uikNumberEdit.getText().toString());
JniWrapper.Status = status;
JniWrapper.PosX = 30.215800f;
JniWrapper.PosY = 60.005200f;
JniWrapper.UpdateUserInfo(JniWrapper.LastName,
JniWrapper.FirstName,
JniWrapper.MiddleName,
JniWrapper.ContactNumber,
JniWrapper.MapState,
JniWrapper.UikNumber,
JniWrapper.Status,
JniWrapper.PosX,
JniWrapper.PosY);
}
});
}
}

View File

@ -0,0 +1,51 @@
package fishrungames.kobserver;
import fishrungames.kobserver.JniWrapper;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
public class SendMessageActivity extends Activity
{
@Override
protected void onCreate(Bundle icicle)
{
super.onCreate(icicle);
setContentView(R.layout.send_message_layout);
Button backbtn = (Button) findViewById(R.id.backButton_send_message);
backbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), MessagesActivity.class);
startActivityForResult(myIntent, 0);
}
});
Button sendMessageButton = (Button) findViewById(R.id.sendMessageButton);
sendMessageButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
EditText messageEdit = (EditText) findViewById(R.id.messageEdit);
JniWrapper.SendMessage(messageEdit.getText().toString());
messageEdit.setText("");
}
});
}
}

332
common/ClientSocket.cpp Normal file
View File

@ -0,0 +1,332 @@
#include "ClientSocket.h"
TClientSocket::TClientSocket(boost::asio::io_service& io_service)
: Socket(io_service)
, IoService(io_service)
, AutorizationCodeResult(" ")
, BlockCloseOnError(false)
, BlockForceCloseMessage(false)
{
}
void TClientSocket::Open(std::string address, std::string port)
{
boost::asio::ip::tcp::resolver resolver(IoService);
boost::asio::ip::tcp::resolver::query query(address.c_str(), port.c_str());
boost::system::error_code ec;
boost::asio::ip::tcp::resolver::iterator iterator = resolver.resolve(query, ec);
boost::asio::ip::tcp::resolver::iterator end;
if (ec)
{
OnAddressNotResolved();
return;
}
boost::asio::async_connect(Socket, iterator, boost::bind(&TClientSocket::HandleConnect, shared_from_this(), boost::asio::placeholders::error));
ConnectionTimeoutTimer = boost::shared_ptr<boost::asio::deadline_timer>(new boost::asio::deadline_timer(IoService, boost::posix_time::seconds(3)));
ConnectionTimeoutTimer->async_wait(boost::bind(&TClientSocket::ConnectTimeout, this, boost::asio::placeholders::error));
}
void TClientSocket::ConnectTimeout(const boost::system::error_code& e)
{
if (e)
{
return;
}
Socket.cancel();
BlockCloseOnError = true;
IoService.stop();
ReceiveForceCloseSignal();
}
void TClientSocket::OnAddressNotResolved()
{
BlockCloseOnError = true;
IoService.stop();
ReceiveForceCloseSignal();
}
void TClientSocket::HandleConnect(const boost::system::error_code& error)
{
if (!error)
{
ConnectionTimeoutTimer->cancel();
boost::asio::async_read(Socket, boost::asio::buffer(&AutorizationCode, 4), boost::bind(&TClientSocket::HandleReadAutorizationCode, shared_from_this(), boost::asio::placeholders::error));
}
else
{
if (!BlockCloseOnError)
{
CloseImmediate();
}
}
}
void TClientSocket::HandleReadAutorizationCode(const boost::system::error_code& error)
{
if (!error)
{
AutorizationCodeResponce = check_func(AutorizationCode);
boost::asio::async_write(Socket, boost::asio::buffer(&AutorizationCodeResponce, 4), boost::bind(&TClientSocket::HandleWrite, shared_from_this(), boost::asio::placeholders::error));
ReadData.resize(16);
boost::asio::async_read(Socket, boost::asio::buffer(&ReadData[0], 16), boost::bind(&TClientSocket::HandleReadAutorizationResult, shared_from_this(), boost::asio::placeholders::error));
ReceiveAutorizationSentSignal();
}
else
{
if (!BlockCloseOnError)
{
CloseImmediate();
}
}
}
void TClientSocket::HandleReadAutorizationResult(const boost::system::error_code& error)
{
if (!error)
{
AutorizationCodeResult = std::string(ReadData.begin(), ReadData.begin() + 2);
if (AutorizationCodeResult == "ok")
{
BaseLon = (reinterpret_cast<float*>(&ReadData[0]))[1];
BaseLat = (reinterpret_cast<float*>(&ReadData[0]))[2];
BaseZoom = (reinterpret_cast<int*>(&ReadData[0]))[3];
boost::asio::async_read(Socket, boost::asio::buffer(&LastSignal, 4), boost::bind(&TClientSocket::HandleReadSignal, shared_from_this(), boost::asio::placeholders::error));
}
}
else
{
if (!BlockCloseOnError)
{
CloseImmediate();
}
}
}
void TClientSocket::HandleReadSignal(const boost::system::error_code& error)
{
if (!error)
{
boost::asio::async_read(Socket, boost::asio::buffer(&ReadDataLenLong, 4), boost::bind(&TClientSocket::HandleReadDataLen, shared_from_this(), boost::asio::placeholders::error));
}
else
{
if (!BlockCloseOnError)
{
CloseImmediate();
}
}
}
void TClientSocket::HandleReadDataLen(const boost::system::error_code& error)
{
if (!error)
{
ReadData.resize(ReadDataLenLong);
if (ReadDataLenLong == 0)
{
boost::asio::async_read(Socket, boost::asio::buffer(&LastSignal, 4), boost::bind(&TClientSocket::HandleReadSignal, shared_from_this(), boost::asio::placeholders::error));
if (LastSignal == 4)
{
}
else if (LastSignal == 1)
{
std::vector<TUserInfo> userInfoArr;
ReceiveMapSignal(userInfoArr);
}
else if (LastSignal == 2)
{
std::vector<TUserInfo> userInfoArr;
ReceiveAlarmMapSignal(userInfoArr);
}
}
else
{
boost::asio::async_read(Socket, boost::asio::buffer(&ReadData[0], ReadDataLenLong), boost::bind(&TClientSocket::HandleReadData, shared_from_this(), boost::asio::placeholders::error));
}
}
else
{
if (!BlockCloseOnError)
{
CloseImmediate();
}
}
}
void TClientSocket::HandleReadData(const boost::system::error_code& error)
{
if (!error)
{
if (LastSignal == 4)
{
std::string message;
TUserInfo userInfo;
DecodeMessage(ReadData, userInfo, message);
ReceiveMessageSignal(userInfo, message);
}
else if (LastSignal == 1)
{
std::vector<TUserInfo> userInfoArr;
DecodeMapUpdateResponce(ReadData, userInfoArr);
ReceiveMapSignal(userInfoArr);
}
else if (LastSignal == 2)
{
std::vector<TUserInfo> userInfoArr;
DecodeAlarmMapUpdateResponce(ReadData, userInfoArr);
ReceiveAlarmMapSignal(userInfoArr);
}
boost::asio::async_read(Socket, boost::asio::buffer(&LastSignal, 4), boost::bind(&TClientSocket::HandleReadSignal, shared_from_this(), boost::asio::placeholders::error));
}
else
{
if (!BlockCloseOnError)
{
CloseImmediate();
}
}
}
void TClientSocket::HandleWrite(const boost::system::error_code& error)
{
if (error)
{
if (!BlockCloseOnError)
{
CloseImmediate();
}
}
}
void TClientSocket::CloseImmediate()
{
// Cancel all outstanding asynchronous operations.
BlockCloseOnError = true;
ConnectionTimeoutTimer->cancel();
Socket.close();
if (!BlockForceCloseMessage)
{
ReceiveForceCloseSignal();
}
}
void TClientSocket::SendMessageImmediate(std::string msg)
{
boost::shared_ptr<TMessageSender>(new TMessageSender(Socket, CONST_SIGNAL_MESSAGE, CreateMessage(UserInfo, msg)))->Send();
}
void TClientSocket::SendUserinfoUpdateImmediate()
{
boost::shared_ptr<TMessageSender>(new TMessageSender(Socket, 3, CreateProfileUpdateQuery(UserInfo)))->Send();
}
void TClientSocket::SendHeartbeatImmediate()
{
boost::shared_ptr<TMessageSender>(new TMessageSender(Socket, 5, CreateHeartBeatQuery(UserInfo)))->Send();
}
void TClientSocket::SendMapQueryImmediate()
{
boost::shared_ptr<TSignalSender>(new TSignalSender(Socket, 1))->Send();
}
void TClientSocket::SendAlarmMapQueryImmediate()
{
boost::shared_ptr<TSignalSender>(new TSignalSender(Socket, 2))->Send();
}
void TClientSocket::SendKickPlayerImmediate(std::string lastName, std::string firstName, std::string middleName)
{
boost::shared_ptr<TMessageSender>(new TMessageSender(Socket, 100, CreateKickPlayerSignal(lastName, firstName, middleName)))->Send();
}
void TClientSocket::CloseThreaded()
{
IoService.post(boost::bind(&TClientSocket::CloseImmediate, this));
}
void TClientSocket::SendMessageThreaded(std::string msg)
{
IoService.post(boost::bind(&TClientSocket::SendMessageImmediate, this, msg));
}
void TClientSocket::SendUserinfoUpdateThreaded()
{
IoService.post(boost::bind(&TClientSocket::SendUserinfoUpdateImmediate, this));
}
void TClientSocket::SendHeartbeatThreaded()
{
IoService.post(boost::bind(&TClientSocket::SendHeartbeatImmediate, this));
}
void TClientSocket::SendMapQueryThreaded()
{
IoService.post(boost::bind(&TClientSocket::SendMapQueryImmediate, this));
}
void TClientSocket::SendAlarmMapQueryThreaded()
{
IoService.post(boost::bind(&TClientSocket::SendAlarmMapQueryImmediate, this));
}
void TClientSocket::SendKickPlayerThreaded(std::string lastName, std::string firstName, std::string middleName)
{
IoService.post(boost::bind(&TClientSocket::SendKickPlayerImmediate, this, lastName, firstName, middleName));
}

80
common/ClientSocket.h Normal file
View File

@ -0,0 +1,80 @@
#ifndef CLIENT_SOCKET_H_INCLUDED
#define CLIENT_SOCKET_H_INCLUDED
#include "UserInfo.h"
#include "misc.h"
#include "MessageSender.h"
struct TClientSocket
: public boost::enable_shared_from_this<TClientSocket>
{
boost::asio::ip::tcp::socket Socket;
boost::asio::io_service& IoService;
boost::shared_ptr<boost::asio::deadline_timer> ConnectionTimeoutTimer;
int AutorizationCode;
int AutorizationCodeResponce;
std::string AutorizationCodeResult;
float BaseLon;
float BaseLat;
int BaseZoom;
int LastSignal;
int ReadDataLenLong;
std::vector<char> ReadData;
TUserInfo UserInfo;
bool BlockCloseOnError;
bool BlockForceCloseMessage;
TClientSocket(boost::asio::io_service& io_service);
void Open(std::string address, std::string port);
void ConnectTimeout(const boost::system::error_code& e);
void OnAddressNotResolved();
void HandleConnect(const boost::system::error_code& error);
void HandleReadAutorizationCode(const boost::system::error_code& error);
void HandleReadAutorizationResult(const boost::system::error_code& error);
void HandleReadSignal(const boost::system::error_code& error);
void HandleReadDataLen(const boost::system::error_code& error);
void HandleReadData(const boost::system::error_code& error);
void HandleWrite(const boost::system::error_code& error);
void CloseImmediate();
void SendMessageImmediate(std::string msg);
void SendUserinfoUpdateImmediate();
void SendHeartbeatImmediate();
void SendMapQueryImmediate();
void SendAlarmMapQueryImmediate();
void SendKickPlayerImmediate(std::string lastName, std::string firstName, std::string middleName);
void CloseThreaded();
void SendMessageThreaded(std::string msg);
void SendUserinfoUpdateThreaded();
void SendHeartbeatThreaded();
void SendMapQueryThreaded();
void SendAlarmMapQueryThreaded();
void SendKickPlayerThreaded(std::string lastName, std::string firstName, std::string middleName);
boost::signal<void (TUserInfo userInfo, std::string message)> ReceiveMessageSignal;
boost::signal<void (std::vector<TUserInfo> userInfoArr)> ReceiveMapSignal;
boost::signal<void (std::vector<TUserInfo> userInfoArr)> ReceiveAlarmMapSignal;
boost::signal<void ()> ReceiveForceCloseSignal;
boost::signal<void ()> ReceiveAutorizationSentSignal;
};
#endif

429
common/MessageSender.cpp Normal file
View File

@ -0,0 +1,429 @@
#include "MessageSender.h"
#include "misc.h"
TSignalSender::TSignalSender(boost::asio::ip::tcp::socket& socket, int messageType)
: Socket(socket)
, MessageType(messageType)
{
}
void TSignalSender::Send()
{
boost::asio::async_write(Socket, boost::asio::buffer(&MessageType, 4), boost::bind(&TSignalSender::Handle, shared_from_this(), boost::asio::placeholders::error));
}
void TSignalSender::Handle(const boost::system::error_code& error)
{
}
TMessageSender::TMessageSender(boost::asio::ip::tcp::socket& socket, int messageType, std::vector<char> messageData)
: Socket(socket)
, MessageType(messageType)
, MessageDataSize(messageData.size())
, MessageData(messageData)
{
}
void TMessageSender::Send()
{
boost::asio::async_write(Socket, boost::asio::buffer(&MessageType, 4), boost::bind(&TMessageSender::Handle, shared_from_this(), boost::asio::placeholders::error));
boost::asio::async_write(Socket, boost::asio::buffer(&MessageDataSize, 4), boost::bind(&TMessageSender::Handle, shared_from_this(), boost::asio::placeholders::error));
if (MessageDataSize > 0)
{
boost::asio::async_write(Socket, boost::asio::buffer(&MessageData[0], MessageDataSize), boost::bind(&TMessageSender::Handle, shared_from_this(), boost::asio::placeholders::error));
}
}
void TMessageSender::Handle(const boost::system::error_code& error)
{
}
std::vector<char> CreateMessage(const TUserInfo& userInfo, std::string message)
{
int bufferSize = userInfo.FirstName.size() + userInfo.MiddleName.size() + userInfo.LastName.size() + userInfo.PhoneNumber.size() + 4 + 4 + 4 + 16 + 4 + message.size() + 1;
std::vector<char> pBuffer;
pBuffer.resize(bufferSize);
//reinterpret_cast<int*>(&pBuffer[0])[0] = CONST_SIGNAL_MESSAGE;
//reinterpret_cast<int*>(&pBuffer[0])[1] = bufferSize - 8;
reinterpret_cast<int*>(&pBuffer[0])[2] = userInfo.MapState;
/*
if (userInfo.Uik != 0)
{
reinterpret_cast<float*>(&pBuffer[0])[3] = CONST_90_DEG;
reinterpret_cast<int*>(&pBuffer[0])[4] = userInfo.Uik;
}
else*/
{
reinterpret_cast<float*>(&pBuffer[0])[3] = userInfo.PosX;
reinterpret_cast<float*>(&pBuffer[0])[4] = userInfo.PosY;
}
pBuffer[20] = static_cast<char>(userInfo.LastName.size());
if (userInfo.LastName.size() != 0)
{
memcpy(&pBuffer[21], &userInfo.LastName[0], userInfo.LastName.size());
}
pBuffer[20 + userInfo.LastName.size() + 1] = static_cast<char>(userInfo.FirstName.size());
if (userInfo.FirstName.size() != 0)
{
memcpy(&pBuffer[userInfo.LastName.size() + 22], &userInfo.FirstName[0], userInfo.FirstName.size());
}
pBuffer[userInfo.LastName.size() + userInfo.FirstName.size() + 22] = static_cast<char>(userInfo.MiddleName.size());
if (userInfo.MiddleName.size() != 0)
{
memcpy(&pBuffer[userInfo.LastName.size() + userInfo.FirstName.size() + 23], &userInfo.MiddleName[0], userInfo.MiddleName.size());
}
pBuffer[userInfo.LastName.size() + userInfo.FirstName.size() + userInfo.MiddleName.size() + 23] = static_cast<char>(userInfo.PhoneNumber.size());
if (userInfo.PhoneNumber.size() != 0)
{
memcpy(&pBuffer[userInfo.LastName.size() + userInfo.FirstName.size() + userInfo.MiddleName.size() + 24], &userInfo.PhoneNumber[0], userInfo.PhoneNumber.size());
}
memcpy(&pBuffer[userInfo.LastName.size() + userInfo.FirstName.size() + userInfo.MiddleName.size() + userInfo.PhoneNumber.size() + 24], &userInfo.Uik, 4);
memcpy(&pBuffer[userInfo.LastName.size() + userInfo.FirstName.size() + userInfo.MiddleName.size() + userInfo.PhoneNumber.size() + 28], &userInfo.Status, 4);
pBuffer[userInfo.LastName.size() + userInfo.FirstName.size() + userInfo.MiddleName.size() + userInfo.PhoneNumber.size() + 32] = message.size();
if (message.size() != 0)
{
memcpy(&pBuffer[userInfo.LastName.size() + userInfo.FirstName.size() + userInfo.MiddleName.size() + userInfo.PhoneNumber.size() + 33], &message[0], message.size());
}
pBuffer = std::vector<char>(pBuffer.begin() + 8, pBuffer.end());
return pBuffer;
}
void DecodeMessage(std::vector<char> msgData, TUserInfo& userInfo, std::string& message)
{
userInfo.MapState = *(reinterpret_cast<int*>(&msgData[0]));
userInfo.PosX = *(reinterpret_cast<float*>(&msgData[4]));
if (userInfo.PosX == CONST_90_DEG)
{
userInfo.PosY = 0.f;
userInfo.Uik = *(reinterpret_cast<int*>(&msgData[8]));
}
else
{
userInfo.PosY = *(reinterpret_cast<float*>(&msgData[8]));
userInfo.Uik = 0;
}
char lastNameLen = msgData[12];
std::string lastName(&msgData[13], &msgData[13 + lastNameLen]);
char firstNameLen = msgData[13 + lastNameLen];
std::string firstName(&msgData[14 + lastNameLen], &msgData[14 + lastNameLen + firstNameLen]);
char middleNameLen = msgData[14 + lastNameLen + firstNameLen];
std::string middleName(&msgData[15 + lastNameLen + firstNameLen], &msgData[15 + lastNameLen + firstNameLen + middleNameLen]);
char phoneLen = msgData[15 + lastNameLen + firstNameLen + middleNameLen];
std::string phone(&msgData[16 + lastNameLen + firstNameLen + middleNameLen], &msgData[16 + lastNameLen + firstNameLen + middleNameLen + phoneLen]);
int uik;
memcpy(&uik, &msgData[16 + lastNameLen + firstNameLen + middleNameLen + phoneLen], 4);
int status;
memcpy(&status, &msgData[16 + lastNameLen + firstNameLen + middleNameLen + phoneLen + 4], 4);
userInfo.LastName = lastName;
userInfo.FirstName = firstName;
userInfo.MiddleName = middleName;
userInfo.PhoneNumber = phone;
userInfo.Uik = uik;
userInfo.Status = status;
char messageLen = msgData[16 + lastNameLen + firstNameLen + middleNameLen + phoneLen + 4 + 4];
message = std::string(msgData.begin() + (16 + lastNameLen + firstNameLen + middleNameLen + phoneLen + 4 + 4 + 1), msgData.begin() + (16 + lastNameLen + firstNameLen + middleNameLen + phoneLen + 4 + 4 + 1 + messageLen));
}
std::vector<char> CreateKickPlayerSignal(std::string lastName, std::string firstName, std::string middleName)
{
int bufferSize = lastName.size() + firstName.size() + middleName.size() + 3;
std::vector<char> pBuffer;
pBuffer.resize(bufferSize);
pBuffer[0] = static_cast<char>(lastName.size());
if (lastName.size() != 0)
{
memcpy(&pBuffer[1], &lastName[0], lastName.size());
}
pBuffer[lastName.size() + 1] = static_cast<char>(firstName.size());
if (firstName.size() != 0)
{
memcpy(&pBuffer[lastName.size() + 2], &firstName[0], firstName.size());
}
pBuffer[lastName.size() + firstName.size() + 2] = static_cast<char>(middleName.size());
if (middleName.size() != 0)
{
memcpy(&pBuffer[lastName.size() + firstName.size() + 3], &middleName[0], middleName.size());
}
//pBuffer = std::vector<char>(pBuffer.begin() + 8, pBuffer.end());
return pBuffer;
}
void DecodeKickPlayerSignal(std::vector<char> msgData, std::string& lastName, std::string& firstName, std::string& middleName)
{
char lastNameLen = msgData[0];
if (lastNameLen > 0)
{
lastName = std::string(&msgData[1], &msgData[1 + lastNameLen]);
}
else
{
lastName = "";
}
char firstNameLen = msgData[1 + lastNameLen];
if (firstNameLen > 0)
{
firstName = std::string(&msgData[2 + lastNameLen], &msgData[2 + lastNameLen + firstNameLen]);
}
else
{
firstName = "";
}
char middleNameLen = msgData[2 + lastNameLen + firstNameLen];
if (middleNameLen > 0)
{
middleName = std::string(&msgData[3 + lastNameLen + firstNameLen], &msgData[3 + lastNameLen + firstNameLen] + middleNameLen);
}
else
{
middleName = "";
}
}
std::vector<char> CreateProfileUpdateQuery(const TUserInfo& userInfo)
{
int bufferSize = userInfo.FirstName.size() + userInfo.MiddleName.size() + userInfo.LastName.size() + userInfo.PhoneNumber.size() + 4 + 16 + 4;
std::vector<char> pBuffer;
pBuffer.resize(bufferSize);
reinterpret_cast<int*>(&pBuffer[0])[0] = userInfo.MapState;
/*if (userInfo.Uik != 0)
{
reinterpret_cast<float*>(&pBuffer[0])[1] = CONST_90_DEG;
reinterpret_cast<int*>(&pBuffer[0])[2] = userInfo.Uik;
}
else*/
{
reinterpret_cast<float*>(&pBuffer[0])[1] = userInfo.PosX;
reinterpret_cast<float*>(&pBuffer[0])[2] = userInfo.PosY;
}
pBuffer[12] = static_cast<char>(userInfo.LastName.size());
if (userInfo.LastName.size() != 0)
{
memcpy(&pBuffer[13], &userInfo.LastName[0], userInfo.LastName.size());
}
pBuffer[12 + userInfo.LastName.size() + 1] = static_cast<char>(userInfo.FirstName.size());
if (userInfo.FirstName.size() != 0)
{
memcpy(&pBuffer[userInfo.LastName.size() + 14], &userInfo.FirstName[0], userInfo.FirstName.size());
}
pBuffer[userInfo.LastName.size() + userInfo.FirstName.size() + 14] = static_cast<char>(userInfo.MiddleName.size());
if (userInfo.MiddleName.size() != 0)
{
memcpy(&pBuffer[userInfo.LastName.size() + userInfo.FirstName.size() + 15], &userInfo.MiddleName[0], userInfo.MiddleName.size());
}
pBuffer[userInfo.LastName.size() + userInfo.FirstName.size() + userInfo.MiddleName.size() + 15] = static_cast<char>(userInfo.PhoneNumber.size());
if (userInfo.PhoneNumber.size() != 0)
{
memcpy(&pBuffer[userInfo.LastName.size() + userInfo.FirstName.size() + userInfo.MiddleName.size() + 16], &userInfo.PhoneNumber[0], userInfo.PhoneNumber.size());
}
memcpy(&pBuffer[userInfo.LastName.size() + userInfo.FirstName.size() + userInfo.MiddleName.size() + userInfo.PhoneNumber.size() + 16], &userInfo.Uik, 4);
memcpy(&pBuffer[userInfo.LastName.size() + userInfo.FirstName.size() + userInfo.MiddleName.size() + userInfo.PhoneNumber.size() + 20], &userInfo.Status, 4);
return pBuffer;
}
void DecodeProfileUpdateQuery(std::vector<char>& msgData, TUserInfo& userInfo)
{
userInfo.MapState = *(reinterpret_cast<int*>(&msgData[0]));
userInfo.PosX = *(reinterpret_cast<float*>(&msgData[4]));
if (userInfo.PosX == CONST_90_DEG)
{
userInfo.PosY = 0.f;
userInfo.Uik = *(reinterpret_cast<int*>(&msgData[8]));
}
else
{
userInfo.PosY = *(reinterpret_cast<float*>(&msgData[8]));
userInfo.Uik = 0;
}
char lastNameLen = msgData[12];
std::string lastName(&msgData[13], &msgData[13 + lastNameLen]);
char firstNameLen = msgData[13 + lastNameLen];
std::string firstName(&msgData[14 + lastNameLen], &msgData[14 + lastNameLen + firstNameLen]);
char middleNameLen = msgData[14 + lastNameLen + firstNameLen];
std::string middleName(&msgData[15 + lastNameLen + firstNameLen], &msgData[15 + lastNameLen + firstNameLen + middleNameLen]);
char phoneLen = msgData[15 + lastNameLen + firstNameLen + middleNameLen];
std::string phone(&msgData[16 + lastNameLen + firstNameLen + middleNameLen], &msgData[16 + lastNameLen + firstNameLen + middleNameLen + phoneLen]);
int uik;
memcpy(&uik, &msgData[16 + lastNameLen + firstNameLen + middleNameLen + phoneLen], 4);
int status;
memcpy(&status, &msgData[16 + lastNameLen + firstNameLen + middleNameLen + phoneLen + 4], 4);
userInfo.LastName = lastName;
userInfo.FirstName = firstName;
userInfo.MiddleName = middleName;
userInfo.PhoneNumber = phone;
userInfo.Uik = uik;
userInfo.Status = status;
int bufferSize = 16 + lastNameLen + firstNameLen + middleNameLen + phoneLen + 4 + 4;
msgData.erase(msgData.begin(), msgData.begin() + bufferSize);
}
std::vector<char> CreateHeartBeatQuery(const TUserInfo& userInfo)
{
int bufferSize = 12;
std::vector<char> pBuffer;
pBuffer.resize(bufferSize);
reinterpret_cast<int*>(&pBuffer[0])[0] = userInfo.MapState;
/*if (userInfo.Uik != 0)
{
reinterpret_cast<float*>(&pBuffer[0])[1] = CONST_90_DEG;
reinterpret_cast<int*>(&pBuffer[0])[2] = userInfo.Uik;
}
else*/
{
reinterpret_cast<float*>(&pBuffer[0])[1] = userInfo.PosX;
reinterpret_cast<float*>(&pBuffer[0])[2] = userInfo.PosY;
}
return pBuffer;
}
void DecodeHeartBeatQuery(std::vector<char>& msgData, TUserInfo& userInfo)
{
userInfo.MapState = *(reinterpret_cast<int*>(&msgData[0]));
userInfo.PosX = *(reinterpret_cast<float*>(&msgData[4]));
if (userInfo.PosX == CONST_90_DEG)
{
userInfo.PosY = 0.f;
userInfo.Uik = *(reinterpret_cast<int*>(&msgData[8]));
}
else
{
userInfo.PosY = *(reinterpret_cast<float*>(&msgData[8]));
//userInfo.Uik = 0;
}
msgData.erase(msgData.begin(), msgData.begin() + 12);
}
void DecodeMapUpdateResponce(std::vector<char> msgData, std::vector<TUserInfo>& userInfoArr)
{
while (msgData.size() >= 12)
{
TUserInfo userInfo;
DecodeHeartBeatQuery(msgData, userInfo);
userInfoArr.push_back(userInfo);
}
}
void DecodeAlarmMapUpdateResponce(std::vector<char> msgData, std::vector<TUserInfo>& userInfoArr)
{
while (msgData.size() > 0)
{
TUserInfo userInfo;
DecodeProfileUpdateQuery(msgData, userInfo);
userInfoArr.push_back(userInfo);
}
}

71
common/MessageSender.h Normal file
View File

@ -0,0 +1,71 @@
#ifndef MESSAGE_SENDER_H_INCLUDED
#define MESSAGE_SENDER_H_INCLUDED
#include "UserInfo.h"
struct TSignalSender
: public boost::enable_shared_from_this<TSignalSender>
{
boost::asio::ip::tcp::socket& Socket;
int MessageType;
TSignalSender(boost::asio::ip::tcp::socket& socket, int messageType);
void Send();
void Handle(const boost::system::error_code& error);
};
struct TMessageSender
: public boost::enable_shared_from_this<TMessageSender>
{
boost::asio::ip::tcp::socket& Socket;
int MessageType;
int MessageDataSize;
std::vector<char> MessageData;
TMessageSender(boost::asio::ip::tcp::socket& socket, int messageType, std::vector<char> messageData);
void Send();
void Handle(const boost::system::error_code& error);
};
std::vector<char> CreateMessage(const TUserInfo& userInfo, std::string message);
void DecodeMessage(std::vector<char> msgData, TUserInfo& userInfo, std::string& message);
std::vector<char> CreateKickPlayerSignal(std::string lastName, std::string firstName, std::string middleName);
void DecodeKickPlayerSignal(std::vector<char> msgData, std::string& lastName, std::string& firstName, std::string& middleName);
std::vector<char> CreateProfileUpdateQuery(const TUserInfo& userInfo);
void DecodeProfileUpdateQuery(std::vector<char>& msgData, TUserInfo& userInfo);
std::vector<char> CreateHeartBeatQuery(const TUserInfo& userInfo);
void DecodeHeartBeatQuery(std::vector<char>& msgData, TUserInfo& userInfo);
void DecodeMapUpdateResponce(std::vector<char> msgData, std::vector<TUserInfo>& userInfoArr);
void DecodeAlarmMapUpdateResponce(std::vector<char> msgData, std::vector<TUserInfo>& userInfoArr);
#endif

13
common/UserInfo.cpp Normal file
View File

@ -0,0 +1,13 @@
#include "UserInfo.h"
TUserInfo::TUserInfo()
: PosX(0)
, PosY(0)
, MapState(1)
, LastName("Anonymous")
, FirstName("Anonymous")
, MiddleName("Anonymous")
, Uik(0)
, Status(0)
{
}

41
common/UserInfo.h Normal file
View File

@ -0,0 +1,41 @@
#ifndef USERINFO_H_INCLUDED
#define USERINFO_H_INCLUDED
#include "boost/asio.hpp"
#include "boost/bind.hpp"
#include "boost/shared_ptr.hpp"
#include "boost/array.hpp"
#include "boost/enable_shared_from_this.hpp"
#include "boost/signal.hpp"
#include "boost/thread.hpp"
#include "boost/date_time/posix_time/posix_time.hpp"
struct TUserInfo
{
float PosX;
float PosY;
size_t MapState;
std::string FirstName;
std::string MiddleName;
std::string LastName;
std::string PhoneNumber;
size_t Uik;
size_t Status;
TUserInfo();
};
#endif

57
common/linux_stuff.cpp Normal file
View File

@ -0,0 +1,57 @@
#ifndef _WIN32
#include "linux_stuff.h"
#include <iostream>
void daemonize()
{
/* Our process ID and Session ID */
pid_t pid, sid;
/* Fork off the parent process */
pid = fork();
if (pid < 0)
{
std::cout<<"error, pid < 0"<<std::endl;
exit(EXIT_FAILURE);
}
/* If we got a good PID, then
we can exit the parent process. */
if (pid > 0) {
std::cout<<"pid > 0 exit process"<<std::endl;
exit(EXIT_SUCCESS);
}
/* Change the file mode mask */
umask(0);
/* Open any logs here */
/* Create a new SID for the child process */
sid = setsid();
if (sid < 0) {
/* Log the failure */
std::cout<<"sid < 0 exit process"<<std::endl;
exit(EXIT_FAILURE);
}
/* Change the current working directory */
if ((chdir("/")) < 0) {
/* Log the failure */
std::cout<<"(chdir(\"/\")) < 0 exit process"<<std::endl;
exit(EXIT_FAILURE);
}
/* Close out the standard file descriptors */
close(STDIN_FILENO);
close(STDOUT_FILENO);
close(STDERR_FILENO);
}
#endif

25
common/linux_stuff.h Normal file
View File

@ -0,0 +1,25 @@
#ifndef LINUX_STUFF_H_INCLUDED
#define LINUX_STUFF_H_INCLUDED
#ifndef _WIN32
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <syslog.h>
#include <string.h>
void daemonize();
#endif
#endif

15
common/misc.cpp Normal file
View File

@ -0,0 +1,15 @@
#include "misc.h"
const float CONST_90_DEG = 90.f;
const int CONST_SIGNAL_MESSAGE = 4;
const std::string CONST_OK = "ok";
const int CONST_MAP_STATE_ALARM = 2;
int check_func(int x)
{
return x*x;
}

19
common/misc.h Normal file
View File

@ -0,0 +1,19 @@
#ifndef MISC_H_INCLUDED
#define MISC_H_INCLUDED
#include "UserInfo.h"
extern const float CONST_90_DEG;
extern const int CONST_SIGNAL_MESSAGE;
extern const std::string CONST_OK;
extern const int CONST_MAP_STATE_ALARM;
int check_func(int x);
#endif

Binary file not shown.

View File

@ -0,0 +1,20 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual C++ Express 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "k_observer_client", "k_observer_client\k_observer_client.vcxproj", "{D5128D35-C07B-40B1-BB51-884A79072B57}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D5128D35-C07B-40B1-BB51-884A79072B57}.Debug|Win32.ActiveCfg = Debug|Win32
{D5128D35-C07B-40B1-BB51-884A79072B57}.Debug|Win32.Build.0 = Debug|Win32
{D5128D35-C07B-40B1-BB51-884A79072B57}.Release|Win32.ActiveCfg = Release|Win32
{D5128D35-C07B-40B1-BB51-884A79072B57}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{D5128D35-C07B-40B1-BB51-884A79072B57}</ProjectGuid>
<RootNamespace>k_observer_client</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>NotSet</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(LibsPath)\boost_1_47_0;../../common</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32_WINNT=0x0501</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(LibsPath)\boost_1_47_0\boost_windows\libs_engine\debug</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<AdditionalIncludeDirectories>$(LibsPath)\boost_1_47_0;../../common</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32_WINNT=0x0501</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalLibraryDirectories>$(LibsPath)\boost_1_47_0\boost_windows\libs_engine\release</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\..\common\ClientSocket.cpp" />
<ClCompile Include="..\..\common\linux_stuff.cpp" />
<ClCompile Include="..\..\common\MessageSender.cpp" />
<ClCompile Include="..\..\common\misc.cpp" />
<ClCompile Include="..\..\common\UserInfo.cpp" />
<ClCompile Include="main.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\common\ClientSocket.h" />
<ClInclude Include="..\..\common\linux_stuff.h" />
<ClInclude Include="..\..\common\MessageSender.h" />
<ClInclude Include="..\..\common\misc.h" />
<ClInclude Include="..\..\common\UserInfo.h" />
<ClInclude Include="main.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,100 @@
#include "main.h"
TUserInfo CustomUserInfo;
void OnAutorizationSend(boost::shared_ptr<TClientSocket> c)
{/*
c->UserInfo.PosX = 37.443195f;
c->UserInfo.PosY = 55.888869f;
c->UserInfo.LastName = std::string("Bot");
c->UserInfo.FirstName = std::string("Mobile");
c->UserInfo.MiddleName = std::string("Idle");
c->UserInfo.PhoneNumber = std::string("+75551234567");
c->UserInfo.Uik = 1;
c->UserInfo.MapState = 0;
c->UserInfo.Status = 1;
*/
c->SendUserinfoUpdateThreaded();
}
int main(int argc, char *argv[])
{
#ifndef _WIN32
daemonize();
#endif
srand(static_cast<unsigned int>(time(0)));
try
{
std::string fileName;
if (argc < 2)
{
fileName = "botdata.txt";
}
else
{
fileName = std::string(argv[1]);
if (fileName == "")
{
fileName = "botdata.txt";
}
}
std::cout<<"File name is - '"<<fileName<<"'"<<std::endl;
std::ifstream f;
f.open(fileName.c_str());
if (f.is_open())
{
std::cout<<"File found"<<std::endl;
f>>CustomUserInfo.LastName;
f>>CustomUserInfo.FirstName;
f>>CustomUserInfo.MiddleName;
f>>CustomUserInfo.PhoneNumber;
f>>CustomUserInfo.PosX;
f>>CustomUserInfo.PosY;
f>>CustomUserInfo.MapState;
f>>CustomUserInfo.Uik;
f>>CustomUserInfo.Status;
f.close();
}
else
{
std::cout<<"File not found, loading default data :("<<std::endl;
}
boost::asio::io_service io_service;
boost::shared_ptr<TClientSocket> c(new TClientSocket(io_service));
c->UserInfo = CustomUserInfo;
c->Open("k-observer.org", "1984");
boost::thread t(boost::bind(&boost::asio::io_service::run, &io_service));
c->ReceiveAutorizationSentSignal.connect(boost::bind(&OnAutorizationSend, c));
t.join();
}
catch (std::exception& e)
{
std::cerr << "Exception: " << e.what() << "\n";
}
return 0;
}

View File

@ -0,0 +1,18 @@
#include <iostream>
#include "boost/asio.hpp"
#include "boost/bind.hpp"
#include "boost/shared_ptr.hpp"
#include "boost/shared_array.hpp"
#include "boost/array.hpp"
#include "boost/enable_shared_from_this.hpp"
#include "boost/thread.hpp"
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <fstream>
#include "ClientSocket.h"
#include "linux_stuff.h"

View File

@ -0,0 +1,54 @@
CC=g++
CFLAGS=-Wall -O3 -I../../../boost_1_47_0
LDFLAGS= -lpthread
#thread
LOCAL_SRC_FILES := ../../../boost_1_47_0/libs/thread/src/pthread/thread.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/thread/src/pthread/once.cpp
#signals
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/signals/src/connection.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/signals/src/named_slot_map.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/signals/src/signal_base.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/signals/src/slot.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/signals/src/trackable.cpp
#system
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/system/src/error_code.cpp
#regex
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/regex/src/c_regex_traits.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/regex/src/cpp_regex_traits.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/regex/src/cregex.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/regex/src/fileiter.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/regex/src/icu.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/regex/src/instances.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/regex/src/posix_api.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/regex/src/regex.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/regex/src/regex_debug.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/regex/src/regex_raw_buffer.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/regex/src/regex_traits_defaults.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/regex/src/static_mutex.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/regex/src/usinstances.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/regex/src/w32_regex_traits.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/regex/src/wc_regex_traits.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/regex/src/wide_posix_api.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/regex/src/winstances.cpp
#date_time
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/date_time/src/gregorian/greg_month.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/date_time/src/gregorian/greg_weekday.cpp
LOCAL_SRC_FILES += ../../../boost_1_47_0/libs/date_time/src/gregorian/date_generators.cpp
CFLAGS += -I../../common
CFLAGS += -I../k_observer_client
LOCAL_SRC_FILES += ../k_observer_client/main.cpp
LOCAL_SRC_FILES += ../../common/ClientSocket.cpp
LOCAL_SRC_FILES += ../../common/MessageSender.cpp
LOCAL_SRC_FILES += ../../common/misc.cpp
LOCAL_SRC_FILES += ../../common/UserInfo.cpp
LOCAL_SRC_FILES += ../../common/linux_stuff.cpp
all:
$(CC) $(LOCAL_SRC_FILES) $(CFLAGS) $(LDFLAGS) -o k_observer_client_bot

View File

@ -0,0 +1,8 @@
Запущен сервер К-Выборы для Твери. Адрес: k-observer.org порт 1996
Мобильное приложение К-Выборы предназначено для координации работы наблюдателей на выборах. Версия для айфона:
http://itunes.apple.com/us/app/k-vybory/id558631995?l=ru
Версия для Android:
https://play.google.com/store/apps/details?id=fishrungames.kobserver
Подробное описание приложения:
http://fishrungames.com/?page_id=48

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -0,0 +1,132 @@
<!DOCTYPE HTML>
<title>OpenLayers Simplest Example</title>
<div id="demoMap" style="height:400px"></div>
<script src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script>
map = new OpenLayers.Map("demoMap");
var mapnik = new OpenLayers.Layer.OSM();
var fromProjection = new OpenLayers.Projection("EPSG:4326"); // Transform from WGS 1984
var toProjection = new OpenLayers.Projection("EPSG:900913"); // to Spherical Mercator Projection
//var position = new OpenLayers.LonLat(37.443195, 55.888869).transform( fromProjection, toProjection);
//var position = new OpenLayers.LonLat(30.2158, 60.0052).transform( fromProjection, toProjection);
//var zoom = 12;
map.addLayer(mapnik);
//map.setCenter(position, zoom);
var markers = new OpenLayers.Layer.Markers( "Markers" );
map.addLayer(markers);
// Interaction; not needed for initial display.
selectControl = new OpenLayers.Control.SelectFeature(markers);
map.addControl(selectControl);
//To be filled before passing to web browser
PointMapToLonLat(<<<LON>>>, <<<LAT>>>, <<<ZOOM>>>);
function PointMapToLonLat(lon, lat, zoom)
{
var position = new OpenLayers.LonLat(lon, lat).transform( fromProjection, toProjection);
map.setCenter(position, zoom);
}
function ActivateSelectControl()
{
selectControl.activate();
}
function DeactivateSelectControl()
{
selectControl.deactivate();
}
function MarkerAddressFromState(state)
{
var marker_addr = "";
marker_addr = "http://mephi1984.jino.ru/osm/marker.png";
if (state == 0)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_mobile.png";
}
else if (state == 1)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker.png";
}
else if (state == 2)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_alarm.png";
}
else if (state == 3)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_exclusion.png";
}
else if (state == 4)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_throw.png";
}
else if (state == 5)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_carousel.png";
}
else if (state == 6)
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_assault.png";
}
else
{
marker_addr = "http://mephi1984.jino.ru/osm/marker_alarm.png";
}
return marker_addr;
}
function AddMarker(x, y, state)
{
var marker_addr = MarkerAddressFromState(state);
var size = new OpenLayers.Size(21,25);
var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
var icon = new OpenLayers.Icon(marker_addr, size, offset);
var lon_Lat = new OpenLayers.LonLat(x, y).transform(fromProjection, toProjection);
markers.addMarker(new OpenLayers.Marker(lon_Lat, icon));
}
function Clear()
{
markers.clearMarkers();
}
function AddMarkerWithPopup(x, y, state, text)
{
var marker_addr = MarkerAddressFromState(state);
var size = new OpenLayers.Size(21,25);
var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
var icon = new OpenLayers.Icon(marker_addr, size, offset);
var lon_Lat = new OpenLayers.LonLat(x, y).transform(fromProjection, toProjection);
var marker = new OpenLayers.Marker(lon_Lat, icon);
marker.events.register('mousedown', marker, function(evt) { alert(text); OpenLayers.Event.stop(evt); });
markers.addMarker(marker);
}
</script>

View File

@ -0,0 +1,548 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
4C02E9D915E9F4AA0051A095 /* MainMenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C02E9D715E9F4AA0051A095 /* MainMenuViewController.m */; };
4C02E9DA15E9F4AA0051A095 /* MainMenuViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C02E9D815E9F4AA0051A095 /* MainMenuViewController.xib */; };
4C02E9E615E9FCF70051A095 /* ProfileViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C02E9E415E9FCF70051A095 /* ProfileViewController.m */; };
4C02E9E715E9FCF70051A095 /* ProfileViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C02E9E515E9FCF70051A095 /* ProfileViewController.xib */; };
4C02E9F415EA18FB0051A095 /* script.html in Resources */ = {isa = PBXBuildFile; fileRef = 4C02E9F315EA18FB0051A095 /* script.html */; };
4C02E9FC15EA1E3C0051A095 /* AlarmViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C02E9F715EA1E3B0051A095 /* AlarmViewController.m */; };
4C02E9FD15EA1E3C0051A095 /* AlarmViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C02E9F815EA1E3B0051A095 /* AlarmViewController.xib */; };
4C02E9FE15EA1E3C0051A095 /* MapViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4C02E9FA15EA1E3C0051A095 /* MapViewController.mm */; };
4C02E9FF15EA1E3C0051A095 /* MapViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C02E9FB15EA1E3C0051A095 /* MapViewController.xib */; };
4C02EA0315EA1E740051A095 /* MessagesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C02EA0115EA1E740051A095 /* MessagesViewController.m */; };
4C02EA0415EA1E740051A095 /* MessagesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C02EA0215EA1E740051A095 /* MessagesViewController.xib */; };
4C7732CE15ED663F003C49DB /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C7732CD15ED663F003C49DB /* CoreLocation.framework */; };
4C79C35C15EBEBC300FE6C7B /* NavigationControllerDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C79C35B15EBEBC300FE6C7B /* NavigationControllerDelegate.m */; };
4C79C36015EC008F00FE6C7B /* ObserverClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4C79C35F15EC008E00FE6C7B /* ObserverClient.mm */; };
4C7BE98B15F391E100E87726 /* alarm_text.png in Resources */ = {isa = PBXBuildFile; fileRef = 4C7BE98A15F391E100E87726 /* alarm_text.png */; };
4C7BE98D15F3954200E87726 /* messages_text.png in Resources */ = {isa = PBXBuildFile; fileRef = 4C7BE98C15F3954200E87726 /* messages_text.png */; };
4C7BE99415F39E0D00E87726 /* button_alarm.png in Resources */ = {isa = PBXBuildFile; fileRef = 4C7BE99215F39E0D00E87726 /* button_alarm.png */; };
4C7BE99515F39E0D00E87726 /* button.png in Resources */ = {isa = PBXBuildFile; fileRef = 4C7BE99315F39E0D00E87726 /* button.png */; };
4C7D07C415F54AB6001DCB2A /* Icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4C7D07BF15F54AB6001DCB2A /* Icon@2x.png */; };
4C7D07C515F54AB6001DCB2A /* Icon-72@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 4C7D07C015F54AB6001DCB2A /* Icon-72@2x.png */; };
4C7D07C615F54AB6001DCB2A /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 4C7D07C115F54AB6001DCB2A /* Icon.png */; };
4C7D07C715F54AB6001DCB2A /* Icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 4C7D07C215F54AB6001DCB2A /* Icon-72.png */; };
4C7D07C815F54AB6001DCB2A /* iTunesArtwork in Resources */ = {isa = PBXBuildFile; fileRef = 4C7D07C315F54AB6001DCB2A /* iTunesArtwork */; };
4C7D07CB15F55E8F001DCB2A /* Splash-portrait.png in Resources */ = {isa = PBXBuildFile; fileRef = 4C7D07CA15F55E8F001DCB2A /* Splash-portrait.png */; };
4C82990115F9315500E85091 /* ObserverClientCpp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C82990015F9315500E85091 /* ObserverClientCpp.cpp */; };
4CA1EE5215F005A400469619 /* SendMessageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA1EE5015F005A400469619 /* SendMessageViewController.m */; };
4CA1EE5315F005A400469619 /* SendMessageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4CA1EE5115F005A400469619 /* SendMessageViewController.xib */; };
4CF8F4BC15E96AB8002E9A61 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CF8F4BB15E96AB8002E9A61 /* UIKit.framework */; };
4CF8F4BE15E96AB8002E9A61 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CF8F4BD15E96AB8002E9A61 /* Foundation.framework */; };
4CF8F4C015E96AB8002E9A61 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CF8F4BF15E96AB8002E9A61 /* CoreGraphics.framework */; };
4CF8F4C615E96AB8002E9A61 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4CF8F4C415E96AB8002E9A61 /* InfoPlist.strings */; };
4CF8F4C815E96AB8002E9A61 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CF8F4C715E96AB8002E9A61 /* main.m */; };
4CF8F4CC15E96AB8002E9A61 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CF8F4CB15E96AB8002E9A61 /* AppDelegate.m */; };
4CF8F4CF15E96AB8002E9A61 /* ConnectViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CF8F4CE15E96AB8002E9A61 /* ConnectViewController.m */; };
4CF8F4D215E96AB9002E9A61 /* ConnectViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4CF8F4D015E96AB9002E9A61 /* ConnectViewController.xib */; };
4CF8F4D915E96C0A002E9A61 /* libboost.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CF8F4D815E96C0A002E9A61 /* libboost.a */; };
4CF8F4E315E96C4F002E9A61 /* ClientSocket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CF8F4DB15E96C4F002E9A61 /* ClientSocket.cpp */; };
4CF8F4E415E96C4F002E9A61 /* MessageSender.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CF8F4DD15E96C4F002E9A61 /* MessageSender.cpp */; };
4CF8F4E515E96C4F002E9A61 /* misc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CF8F4DF15E96C4F002E9A61 /* misc.cpp */; };
4CF8F4E615E96C4F002E9A61 /* UserInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CF8F4E115E96C4F002E9A61 /* UserInfo.cpp */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
4C02E9D615E9F4AA0051A095 /* MainMenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainMenuViewController.h; sourceTree = "<group>"; };
4C02E9D715E9F4AA0051A095 /* MainMenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainMenuViewController.m; sourceTree = "<group>"; };
4C02E9D815E9F4AA0051A095 /* MainMenuViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainMenuViewController.xib; sourceTree = "<group>"; };
4C02E9E315E9FCF70051A095 /* ProfileViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProfileViewController.h; sourceTree = "<group>"; };
4C02E9E415E9FCF70051A095 /* ProfileViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ProfileViewController.m; sourceTree = "<group>"; };
4C02E9E515E9FCF70051A095 /* ProfileViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ProfileViewController.xib; sourceTree = "<group>"; };
4C02E9F315EA18FB0051A095 /* script.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; name = script.html; path = assets/script.html; sourceTree = "<group>"; };
4C02E9F615EA1E3B0051A095 /* AlarmViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AlarmViewController.h; sourceTree = "<group>"; };
4C02E9F715EA1E3B0051A095 /* AlarmViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AlarmViewController.m; sourceTree = "<group>"; };
4C02E9F815EA1E3B0051A095 /* AlarmViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AlarmViewController.xib; sourceTree = "<group>"; };
4C02E9F915EA1E3C0051A095 /* MapViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MapViewController.h; sourceTree = "<group>"; };
4C02E9FA15EA1E3C0051A095 /* MapViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MapViewController.mm; sourceTree = "<group>"; };
4C02E9FB15EA1E3C0051A095 /* MapViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MapViewController.xib; sourceTree = "<group>"; };
4C02EA0015EA1E740051A095 /* MessagesViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessagesViewController.h; sourceTree = "<group>"; };
4C02EA0115EA1E740051A095 /* MessagesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessagesViewController.m; sourceTree = "<group>"; };
4C02EA0215EA1E740051A095 /* MessagesViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MessagesViewController.xib; sourceTree = "<group>"; };
4C7732CD15ED663F003C49DB /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; };
4C79C35A15EBEBC300FE6C7B /* NavigationControllerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NavigationControllerDelegate.h; sourceTree = "<group>"; };
4C79C35B15EBEBC300FE6C7B /* NavigationControllerDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NavigationControllerDelegate.m; sourceTree = "<group>"; };
4C79C35E15EC008E00FE6C7B /* ObserverClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObserverClient.h; sourceTree = "<group>"; };
4C79C35F15EC008E00FE6C7B /* ObserverClient.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ObserverClient.mm; sourceTree = "<group>"; };
4C7BE98A15F391E100E87726 /* alarm_text.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = alarm_text.png; path = assets/alarm_text.png; sourceTree = "<group>"; };
4C7BE98C15F3954200E87726 /* messages_text.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = messages_text.png; path = assets/messages_text.png; sourceTree = "<group>"; };
4C7BE99215F39E0D00E87726 /* button_alarm.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = button_alarm.png; path = assets/button_alarm.png; sourceTree = "<group>"; };
4C7BE99315F39E0D00E87726 /* button.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = button.png; path = assets/button.png; sourceTree = "<group>"; };
4C7D07BF15F54AB6001DCB2A /* Icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon@2x.png"; sourceTree = "<group>"; };
4C7D07C015F54AB6001DCB2A /* Icon-72@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72@2x.png"; sourceTree = "<group>"; };
4C7D07C115F54AB6001DCB2A /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
4C7D07C215F54AB6001DCB2A /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72.png"; sourceTree = "<group>"; };
4C7D07C315F54AB6001DCB2A /* iTunesArtwork */ = {isa = PBXFileReference; lastKnownFileType = file; path = iTunesArtwork; sourceTree = "<group>"; };
4C7D07CA15F55E8F001DCB2A /* Splash-portrait.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Splash-portrait.png"; path = "icons/Splash-portrait.png"; sourceTree = "<group>"; };
4C8298FE15F9312A00E85091 /* ObserverClientCpp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ObserverClientCpp.h; sourceTree = "<group>"; };
4C82990015F9315500E85091 /* ObserverClientCpp.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ObserverClientCpp.cpp; sourceTree = "<group>"; };
4CA1EE4F15F005A400469619 /* SendMessageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SendMessageViewController.h; sourceTree = "<group>"; };
4CA1EE5015F005A400469619 /* SendMessageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SendMessageViewController.m; sourceTree = "<group>"; };
4CA1EE5115F005A400469619 /* SendMessageViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SendMessageViewController.xib; sourceTree = "<group>"; };
4CF8F4B715E96AB8002E9A61 /* k-observer-iphone.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "k-observer-iphone.app"; sourceTree = BUILT_PRODUCTS_DIR; };
4CF8F4BB15E96AB8002E9A61 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
4CF8F4BD15E96AB8002E9A61 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
4CF8F4BF15E96AB8002E9A61 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
4CF8F4C315E96AB8002E9A61 /* k-observer-iphone-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "k-observer-iphone-Info.plist"; sourceTree = "<group>"; };
4CF8F4C515E96AB8002E9A61 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
4CF8F4C715E96AB8002E9A61 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
4CF8F4C915E96AB8002E9A61 /* k-observer-iphone-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "k-observer-iphone-Prefix.pch"; sourceTree = "<group>"; };
4CF8F4CA15E96AB8002E9A61 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
4CF8F4CB15E96AB8002E9A61 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
4CF8F4CD15E96AB8002E9A61 /* ConnectViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ConnectViewController.h; sourceTree = "<group>"; };
4CF8F4CE15E96AB8002E9A61 /* ConnectViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ConnectViewController.m; sourceTree = "<group>"; };
4CF8F4D115E96AB9002E9A61 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/ConnectViewController.xib; sourceTree = "<group>"; };
4CF8F4D815E96C0A002E9A61 /* libboost.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libboost.a; path = "../../../../libs/boost_1_47_0/build-ios/ios-device/libboost.a"; sourceTree = "<group>"; };
4CF8F4DB15E96C4F002E9A61 /* ClientSocket.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClientSocket.cpp; path = ../../../common/ClientSocket.cpp; sourceTree = "<group>"; };
4CF8F4DC15E96C4F002E9A61 /* ClientSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClientSocket.h; path = ../../../common/ClientSocket.h; sourceTree = "<group>"; };
4CF8F4DD15E96C4F002E9A61 /* MessageSender.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MessageSender.cpp; path = ../../../common/MessageSender.cpp; sourceTree = "<group>"; };
4CF8F4DE15E96C4F002E9A61 /* MessageSender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MessageSender.h; path = ../../../common/MessageSender.h; sourceTree = "<group>"; };
4CF8F4DF15E96C4F002E9A61 /* misc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = misc.cpp; path = ../../../common/misc.cpp; sourceTree = "<group>"; };
4CF8F4E015E96C4F002E9A61 /* misc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = misc.h; path = ../../../common/misc.h; sourceTree = "<group>"; };
4CF8F4E115E96C4F002E9A61 /* UserInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UserInfo.cpp; path = ../../../common/UserInfo.cpp; sourceTree = "<group>"; };
4CF8F4E215E96C4F002E9A61 /* UserInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UserInfo.h; path = ../../../common/UserInfo.h; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
4CF8F4B415E96AB8002E9A61 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
4C7732CE15ED663F003C49DB /* CoreLocation.framework in Frameworks */,
4CF8F4D915E96C0A002E9A61 /* libboost.a in Frameworks */,
4CF8F4BC15E96AB8002E9A61 /* UIKit.framework in Frameworks */,
4CF8F4BE15E96AB8002E9A61 /* Foundation.framework in Frameworks */,
4CF8F4C015E96AB8002E9A61 /* CoreGraphics.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
4C02E9F515EA19040051A095 /* assets */ = {
isa = PBXGroup;
children = (
4C7BE99215F39E0D00E87726 /* button_alarm.png */,
4C7BE99315F39E0D00E87726 /* button.png */,
4C7BE98C15F3954200E87726 /* messages_text.png */,
4C7BE98A15F391E100E87726 /* alarm_text.png */,
4C02E9F315EA18FB0051A095 /* script.html */,
);
name = assets;
sourceTree = "<group>";
};
4C7D07BE15F54AB6001DCB2A /* Icons */ = {
isa = PBXGroup;
children = (
4C7D07BF15F54AB6001DCB2A /* Icon@2x.png */,
4C7D07C015F54AB6001DCB2A /* Icon-72@2x.png */,
4C7D07C115F54AB6001DCB2A /* Icon.png */,
4C7D07C215F54AB6001DCB2A /* Icon-72.png */,
4C7D07C315F54AB6001DCB2A /* iTunesArtwork */,
);
name = Icons;
path = "k-observer-iphone/icons";
sourceTree = "<group>";
};
4C8298F615F9307900E85091 /* SendMessage */ = {
isa = PBXGroup;
children = (
4CA1EE4F15F005A400469619 /* SendMessageViewController.h */,
4CA1EE5015F005A400469619 /* SendMessageViewController.m */,
4CA1EE5115F005A400469619 /* SendMessageViewController.xib */,
);
name = SendMessage;
sourceTree = "<group>";
};
4C8298F715F9309200E85091 /* Alarm */ = {
isa = PBXGroup;
children = (
4C02E9F615EA1E3B0051A095 /* AlarmViewController.h */,
4C02E9F715EA1E3B0051A095 /* AlarmViewController.m */,
4C02E9F815EA1E3B0051A095 /* AlarmViewController.xib */,
);
name = Alarm;
sourceTree = "<group>";
};
4C8298F815F930A800E85091 /* Map */ = {
isa = PBXGroup;
children = (
4C02E9F915EA1E3C0051A095 /* MapViewController.h */,
4C02E9FA15EA1E3C0051A095 /* MapViewController.mm */,
4C02E9FB15EA1E3C0051A095 /* MapViewController.xib */,
);
name = Map;
sourceTree = "<group>";
};
4C8298F915F930B700E85091 /* Classes */ = {
isa = PBXGroup;
children = (
4CF8F4CA15E96AB8002E9A61 /* AppDelegate.h */,
4CF8F4CB15E96AB8002E9A61 /* AppDelegate.m */,
4C79C35A15EBEBC300FE6C7B /* NavigationControllerDelegate.h */,
4C79C35B15EBEBC300FE6C7B /* NavigationControllerDelegate.m */,
4C79C35E15EC008E00FE6C7B /* ObserverClient.h */,
4C79C35F15EC008E00FE6C7B /* ObserverClient.mm */,
4C8298FD15F930E400E85091 /* Messages */,
4C8298FC15F930DB00E85091 /* Profile */,
4C8298FB15F930D100E85091 /* MainMenu */,
4C8298FA15F930C400E85091 /* Connect */,
4C8298F815F930A800E85091 /* Map */,
4C8298F715F9309200E85091 /* Alarm */,
4C8298F615F9307900E85091 /* SendMessage */,
);
name = Classes;
sourceTree = "<group>";
};
4C8298FA15F930C400E85091 /* Connect */ = {
isa = PBXGroup;
children = (
4CF8F4CD15E96AB8002E9A61 /* ConnectViewController.h */,
4CF8F4CE15E96AB8002E9A61 /* ConnectViewController.m */,
4CF8F4D015E96AB9002E9A61 /* ConnectViewController.xib */,
);
name = Connect;
sourceTree = "<group>";
};
4C8298FB15F930D100E85091 /* MainMenu */ = {
isa = PBXGroup;
children = (
4C02E9D615E9F4AA0051A095 /* MainMenuViewController.h */,
4C02E9D715E9F4AA0051A095 /* MainMenuViewController.m */,
4C02E9D815E9F4AA0051A095 /* MainMenuViewController.xib */,
);
name = MainMenu;
sourceTree = "<group>";
};
4C8298FC15F930DB00E85091 /* Profile */ = {
isa = PBXGroup;
children = (
4C02E9E315E9FCF70051A095 /* ProfileViewController.h */,
4C02E9E415E9FCF70051A095 /* ProfileViewController.m */,
4C02E9E515E9FCF70051A095 /* ProfileViewController.xib */,
);
name = Profile;
sourceTree = "<group>";
};
4C8298FD15F930E400E85091 /* Messages */ = {
isa = PBXGroup;
children = (
4C02EA0015EA1E740051A095 /* MessagesViewController.h */,
4C02EA0115EA1E740051A095 /* MessagesViewController.m */,
4C02EA0215EA1E740051A095 /* MessagesViewController.xib */,
);
name = Messages;
sourceTree = "<group>";
};
4CF8F4AC15E96AB7002E9A61 = {
isa = PBXGroup;
children = (
4C7D07BE15F54AB6001DCB2A /* Icons */,
4C7732CD15ED663F003C49DB /* CoreLocation.framework */,
4C02E9F515EA19040051A095 /* assets */,
4CF8F4D815E96C0A002E9A61 /* libboost.a */,
4CF8F4C115E96AB8002E9A61 /* k-observer-iphone */,
4CF8F4BA15E96AB8002E9A61 /* Frameworks */,
4CF8F4B815E96AB8002E9A61 /* Products */,
);
sourceTree = "<group>";
};
4CF8F4B815E96AB8002E9A61 /* Products */ = {
isa = PBXGroup;
children = (
4CF8F4B715E96AB8002E9A61 /* k-observer-iphone.app */,
);
name = Products;
sourceTree = "<group>";
};
4CF8F4BA15E96AB8002E9A61 /* Frameworks */ = {
isa = PBXGroup;
children = (
4CF8F4BB15E96AB8002E9A61 /* UIKit.framework */,
4CF8F4BD15E96AB8002E9A61 /* Foundation.framework */,
4CF8F4BF15E96AB8002E9A61 /* CoreGraphics.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
4CF8F4C115E96AB8002E9A61 /* k-observer-iphone */ = {
isa = PBXGroup;
children = (
4C8298F915F930B700E85091 /* Classes */,
4CF8F4C215E96AB8002E9A61 /* Supporting Files */,
4CF8F4DA15E96C21002E9A61 /* common */,
4C8298FE15F9312A00E85091 /* ObserverClientCpp.h */,
4C82990015F9315500E85091 /* ObserverClientCpp.cpp */,
);
path = "k-observer-iphone";
sourceTree = "<group>";
};
4CF8F4C215E96AB8002E9A61 /* Supporting Files */ = {
isa = PBXGroup;
children = (
4C7D07CA15F55E8F001DCB2A /* Splash-portrait.png */,
4CF8F4C315E96AB8002E9A61 /* k-observer-iphone-Info.plist */,
4CF8F4C415E96AB8002E9A61 /* InfoPlist.strings */,
4CF8F4C715E96AB8002E9A61 /* main.m */,
4CF8F4C915E96AB8002E9A61 /* k-observer-iphone-Prefix.pch */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
4CF8F4DA15E96C21002E9A61 /* common */ = {
isa = PBXGroup;
children = (
4CF8F4DB15E96C4F002E9A61 /* ClientSocket.cpp */,
4CF8F4DC15E96C4F002E9A61 /* ClientSocket.h */,
4CF8F4DD15E96C4F002E9A61 /* MessageSender.cpp */,
4CF8F4DE15E96C4F002E9A61 /* MessageSender.h */,
4CF8F4DF15E96C4F002E9A61 /* misc.cpp */,
4CF8F4E015E96C4F002E9A61 /* misc.h */,
4CF8F4E115E96C4F002E9A61 /* UserInfo.cpp */,
4CF8F4E215E96C4F002E9A61 /* UserInfo.h */,
);
name = common;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
4CF8F4B615E96AB8002E9A61 /* k-observer-iphone */ = {
isa = PBXNativeTarget;
buildConfigurationList = 4CF8F4D515E96AB9002E9A61 /* Build configuration list for PBXNativeTarget "k-observer-iphone" */;
buildPhases = (
4CF8F4B315E96AB8002E9A61 /* Sources */,
4CF8F4B415E96AB8002E9A61 /* Frameworks */,
4CF8F4B515E96AB8002E9A61 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = "k-observer-iphone";
productName = "k-observer-iphone";
productReference = 4CF8F4B715E96AB8002E9A61 /* k-observer-iphone.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
4CF8F4AE15E96AB7002E9A61 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0430;
};
buildConfigurationList = 4CF8F4B115E96AB7002E9A61 /* Build configuration list for PBXProject "k-observer-iphone" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 4CF8F4AC15E96AB7002E9A61;
productRefGroup = 4CF8F4B815E96AB8002E9A61 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
4CF8F4B615E96AB8002E9A61 /* k-observer-iphone */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
4CF8F4B515E96AB8002E9A61 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4CF8F4C615E96AB8002E9A61 /* InfoPlist.strings in Resources */,
4CF8F4D215E96AB9002E9A61 /* ConnectViewController.xib in Resources */,
4C02E9DA15E9F4AA0051A095 /* MainMenuViewController.xib in Resources */,
4C02E9E715E9FCF70051A095 /* ProfileViewController.xib in Resources */,
4C02E9F415EA18FB0051A095 /* script.html in Resources */,
4C02E9FD15EA1E3C0051A095 /* AlarmViewController.xib in Resources */,
4C02E9FF15EA1E3C0051A095 /* MapViewController.xib in Resources */,
4C02EA0415EA1E740051A095 /* MessagesViewController.xib in Resources */,
4CA1EE5315F005A400469619 /* SendMessageViewController.xib in Resources */,
4C7BE98B15F391E100E87726 /* alarm_text.png in Resources */,
4C7BE98D15F3954200E87726 /* messages_text.png in Resources */,
4C7BE99415F39E0D00E87726 /* button_alarm.png in Resources */,
4C7BE99515F39E0D00E87726 /* button.png in Resources */,
4C7D07C415F54AB6001DCB2A /* Icon@2x.png in Resources */,
4C7D07C515F54AB6001DCB2A /* Icon-72@2x.png in Resources */,
4C7D07C615F54AB6001DCB2A /* Icon.png in Resources */,
4C7D07C715F54AB6001DCB2A /* Icon-72.png in Resources */,
4C7D07C815F54AB6001DCB2A /* iTunesArtwork in Resources */,
4C7D07CB15F55E8F001DCB2A /* Splash-portrait.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
4CF8F4B315E96AB8002E9A61 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4CF8F4C815E96AB8002E9A61 /* main.m in Sources */,
4CF8F4CC15E96AB8002E9A61 /* AppDelegate.m in Sources */,
4CF8F4CF15E96AB8002E9A61 /* ConnectViewController.m in Sources */,
4CF8F4E315E96C4F002E9A61 /* ClientSocket.cpp in Sources */,
4CF8F4E415E96C4F002E9A61 /* MessageSender.cpp in Sources */,
4CF8F4E515E96C4F002E9A61 /* misc.cpp in Sources */,
4CF8F4E615E96C4F002E9A61 /* UserInfo.cpp in Sources */,
4C02E9D915E9F4AA0051A095 /* MainMenuViewController.m in Sources */,
4C02E9E615E9FCF70051A095 /* ProfileViewController.m in Sources */,
4C02E9FC15EA1E3C0051A095 /* AlarmViewController.m in Sources */,
4C02E9FE15EA1E3C0051A095 /* MapViewController.mm in Sources */,
4C02EA0315EA1E740051A095 /* MessagesViewController.m in Sources */,
4C79C35C15EBEBC300FE6C7B /* NavigationControllerDelegate.m in Sources */,
4C79C36015EC008F00FE6C7B /* ObserverClient.mm in Sources */,
4CA1EE5215F005A400469619 /* SendMessageViewController.m in Sources */,
4C82990115F9315500E85091 /* ObserverClientCpp.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXVariantGroup section */
4CF8F4C415E96AB8002E9A61 /* InfoPlist.strings */ = {
isa = PBXVariantGroup;
children = (
4CF8F4C515E96AB8002E9A61 /* en */,
);
name = InfoPlist.strings;
sourceTree = "<group>";
};
4CF8F4D015E96AB9002E9A61 /* ConnectViewController.xib */ = {
isa = PBXVariantGroup;
children = (
4CF8F4D115E96AB9002E9A61 /* en */,
);
name = ConnectViewController.xib;
sourceTree = "<group>";
};
/* End PBXVariantGroup section */
/* Begin XCBuildConfiguration section */
4CF8F4D315E96AB9002E9A61 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
SDKROOT = iphoneos;
};
name = Debug;
};
4CF8F4D415E96AB9002E9A61 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ENABLE_OBJC_ARC = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
4CF8F4D615E96AB9002E9A61 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "k-observer-iphone/k-observer-iphone-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
GCC_VERSION = "";
HEADER_SEARCH_PATHS = "$(LibsPath)/boost_1_47_0";
INFOPLIST_FILE = "k-observer-iphone/k-observer-iphone-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
LIBRARY_SEARCH_PATHS = "$(inherited)";
"LIBRARY_SEARCH_PATHS[sdk=iphoneos*]" = "$(LibsPath)/boost_1_47_0/build-ios/ios-device";
"LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*]" = "$(LibsPath)/boost_1_47_0/build-ios/ios-simulator";
OTHER_CFLAGS = "";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = 1;
USER_HEADER_SEARCH_PATHS = "";
VALID_ARCHS = armv7;
WRAPPER_EXTENSION = app;
};
name = Debug;
};
4CF8F4D715E96AB9002E9A61 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "k-observer-iphone/k-observer-iphone-Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = "";
GCC_VERSION = "";
HEADER_SEARCH_PATHS = "$(LibsPath)/boost_1_47_0";
INFOPLIST_FILE = "k-observer-iphone/k-observer-iphone-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
LIBRARY_SEARCH_PATHS = "$(inherited)";
"LIBRARY_SEARCH_PATHS[sdk=iphoneos*]" = "$(LibsPath)/boost_1_47_0/build-ios/ios-device";
"LIBRARY_SEARCH_PATHS[sdk=iphonesimulator*]" = "$(LibsPath)/boost_1_47_0/build-ios/ios-simulator";
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = 1;
USER_HEADER_SEARCH_PATHS = "";
VALID_ARCHS = armv7;
WRAPPER_EXTENSION = app;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
4CF8F4B115E96AB7002E9A61 /* Build configuration list for PBXProject "k-observer-iphone" */ = {
isa = XCConfigurationList;
buildConfigurations = (
4CF8F4D315E96AB9002E9A61 /* Debug */,
4CF8F4D415E96AB9002E9A61 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
4CF8F4D515E96AB9002E9A61 /* Build configuration list for PBXNativeTarget "k-observer-iphone" */ = {
isa = XCConfigurationList;
buildConfigurations = (
4CF8F4D615E96AB9002E9A61 /* Debug */,
4CF8F4D715E96AB9002E9A61 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 4CF8F4AE15E96AB7002E9A61 /* Project object */;
}

View File

@ -0,0 +1,23 @@
//
// AlarmViewController.h
// k-observer-iphone
//
// Created by vvv ооо on 26.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AlarmViewController : UIViewController<UIScrollViewDelegate, UITextViewDelegate>
- (void)textViewDidBeginEditing:(UITextView *)textView;
- (void)finishEditingMessage;
- (IBAction)OnRejectPressed;
- (IBAction)OnThrowPressed;
- (IBAction)OnCarouselPressed;
- (IBAction)OnAssaultPressed;
- (IBAction)OnOtherPressed;
- (IBAction)OnSendAdditionalMessage;
@end

View File

@ -0,0 +1,132 @@
//
// AlarmViewController.m
// k-observer-iphone
//
// Created by vvv ооо on 26.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "AlarmViewController.h"
#import "AppDelegate.h"
#import "ProfileViewController.h"
AppDelegate* appDelegate;
@interface AlarmViewController ()
@end
@implementation AlarmViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self)
{
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
UIScrollView *tempScrollView=(UIScrollView *)self.view;
tempScrollView.contentSize=CGSizeMake(320, 700);
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
-(void)viewDidAppear:(BOOL)animated
{
if ([appDelegate.observerClient GetMapState] >= 1)
{
[appDelegate.profileViewController SwitchAlarmSelector:YES];
}
if ([appDelegate.observerClient GetMapState] == 1)
{
[appDelegate.observerClient SetMapState:2];
[appDelegate.observerClient SendMessage:@"ТРЕВОГА (АВТОМАТИЧЕСКОЕ СООБЩЕНИЕ)"];
}
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (void)finishEditingMessage
{
[self.view endEditing:YES];
self.navigationItem.rightBarButtonItem = nil;
}
- (IBAction)OnRejectPressed
{
[appDelegate.observerClient SetMapState:3];
[appDelegate.observerClient SendMessage:@"ТРЕВОГА: УДАЛЕНИЕ С УИК (АВТОМАТИЧЕСКОЕ СООБЩЕНИЕ)"];
[appDelegate.profileViewController SwitchAlarmSelector:YES];
}
- (IBAction)OnThrowPressed
{
[appDelegate.observerClient SetMapState:4];
[appDelegate.profileViewController SwitchAlarmSelector:YES];
[appDelegate.observerClient SendMessage:@"ТРЕВОГА: ВБРОС (АВТОМАТИЧЕСКОЕ СООБЩЕНИЕ)"];
}
- (IBAction)OnCarouselPressed
{
[appDelegate.observerClient SetMapState:5];
[appDelegate.profileViewController SwitchAlarmSelector:YES];
[appDelegate.observerClient SendMessage:@"ТРЕВОГА: КАРУСЕЛЬ (АВТОМАТИЧЕСКОЕ СООБЩЕНИЕ)"];
}
- (IBAction)OnAssaultPressed
{
[appDelegate.observerClient SetMapState:6];
[appDelegate.profileViewController SwitchAlarmSelector:YES];
[appDelegate.observerClient SendMessage:@"ТРЕВОГА: НАПАДЕНИЕ (АВТОМАТИЧЕСКОЕ СООБЩЕНИЕ)"];
}
- (IBAction)OnOtherPressed
{
[appDelegate.observerClient SetMapState:2];
[appDelegate.profileViewController SwitchAlarmSelector:YES];
[appDelegate.observerClient SendMessage:@"ТРЕВОГА: ДРУГОЕ (АВТОМАТИЧЕСКОЕ СООБЩЕНИЕ)"];
}
- (IBAction)OnSendAdditionalMessage
{
UITextView* textView = (UITextView*)[self.view viewWithTag:2];
NSString* msg = textView.text;
if (![msg isEqualToString:@""])
{
[textView setText:@""];
[appDelegate.observerClient SendMessage:msg];
}
}
- (void)textViewDidBeginEditing:(UITextView *)textView
{
UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Готово" style:UIBarButtonItemStylePlain target:self action:@selector(finishEditingMessage)];
self.navigationItem.rightBarButtonItem = anotherButton;
}
@end

View File

@ -0,0 +1,572 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1296</int>
<string key="IBDocument.SystemVersion">11E53</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">1181</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBUITextView</string>
<string>IBUIButton</string>
<string>IBUIImageView</string>
<string>IBUIView</string>
<string>IBUILabel</string>
<string>IBProxyObject</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="975951072">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUIButton" id="815152589">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{40, 67}, {240, 36}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="934489006"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Удаление с участка</string>
<object class="NSColor" key="IBUIHighlightedTitleColor" id="134904318">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4zMTUyMTczOTEzIDAuMDA3NDMwODQ2NTgyIDAAA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleShadowColor" id="675870510">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC41AA</bytes>
</object>
<object class="NSCustomResource" key="IBUINormalBackgroundImage" id="858910736">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">button_alarm.png</string>
</object>
<object class="IBUIFontDescription" key="IBUIFontDescription" id="1003251016">
<int key="type">2</int>
<double key="pointSize">15</double>
</object>
<object class="NSFont" key="IBUIFont" id="892762088">
<string key="NSName">Helvetica-Bold</string>
<double key="NSSize">15</double>
<int key="NSfFlags">16</int>
</object>
</object>
<object class="IBUIButton" id="934489006">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{40, 131}, {240, 36}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="927190473"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Вброс</string>
<reference key="IBUIHighlightedTitleColor" ref="134904318"/>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4zMTUyMTczOTEzIDAuMDA3NDMwODQ2NTgyIDAAA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="675870510"/>
<reference key="IBUINormalBackgroundImage" ref="858910736"/>
<reference key="IBUIFontDescription" ref="1003251016"/>
<reference key="IBUIFont" ref="892762088"/>
</object>
<object class="IBUILabel" id="94214199">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{26, 1}, {268, 58}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="815152589"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Включен режим тревоги. Что случилось?</string>
<object class="NSColor" key="IBUITextColor" id="741793553">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUINumberOfLines">2</int>
<object class="IBUIFontDescription" key="IBUIFontDescription" id="710601501">
<int key="type">1</int>
<double key="pointSize">17</double>
</object>
<object class="NSFont" key="IBUIFont" id="507031330">
<string key="NSName">Helvetica</string>
<double key="NSSize">17</double>
<int key="NSfFlags">16</int>
</object>
</object>
<object class="IBUIButton" id="927190473">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{40, 197}, {240, 36}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="290239366"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Карусель</string>
<reference key="IBUIHighlightedTitleColor" ref="134904318"/>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4zMTUyMTczOTEzIDAuMDA3NDMwODQ2NTgyIDAAA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="675870510"/>
<reference key="IBUINormalBackgroundImage" ref="858910736"/>
<reference key="IBUIFontDescription" ref="1003251016"/>
<reference key="IBUIFont" ref="892762088"/>
</object>
<object class="IBUIButton" id="290239366">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{40, 267}, {240, 36}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="339163673"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Нападение</string>
<reference key="IBUIHighlightedTitleColor" ref="134904318"/>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4zMTUyMTczOTEzIDAuMDA3NDMwODQ2NTgyIDAAA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="675870510"/>
<reference key="IBUINormalBackgroundImage" ref="858910736"/>
<reference key="IBUIFontDescription" ref="1003251016"/>
<reference key="IBUIFont" ref="892762088"/>
</object>
<object class="IBUIButton" id="339163673">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{40, 334}, {240, 36}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="710805769"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Другое</string>
<reference key="IBUIHighlightedTitleColor" ref="134904318"/>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4zMTUyMTczOTEzIDAuMDA3NDMwODQ2NTgyIDAAA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="675870510"/>
<reference key="IBUINormalBackgroundImage" ref="858910736"/>
<reference key="IBUIFontDescription" ref="1003251016"/>
<reference key="IBUIFont" ref="892762088"/>
</object>
<object class="IBUILabel" id="710805769">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{43, 402}, {234, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="471912133"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Дополнительное сообщение:</string>
<reference key="IBUITextColor" ref="741793553"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<reference key="IBUIFontDescription" ref="710601501"/>
<reference key="IBUIFont" ref="507031330"/>
</object>
<object class="IBUIImageView" id="837776317">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 431}, {280, 80}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="435178514"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSCustomResource" key="IBUIImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">alarm_text.png</string>
</object>
</object>
<object class="IBUITextView" id="471912133">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 431}, {280, 80}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="837776317"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC45MjM5MTMwNDM1IDAuOTIzOTEzMDQzNSAwLjkyMzkxMzA0MzUgMAA</bytes>
</object>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
<int key="IBUITag">2</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText"/>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<int key="IBUIAutocapitalizationType">2</int>
<int key="IBUIKeyboardAppearance">1</int>
<int key="IBUIReturnKeyType">9</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIFontDescription" key="IBUIFontDescription">
<int key="type">1</int>
<double key="pointSize">14</double>
</object>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica</string>
<double key="NSSize">14</double>
<int key="NSfFlags">16</int>
</object>
</object>
<object class="IBUIButton" id="435178514">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{40, 519}, {240, 36}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Отправить</string>
<reference key="IBUIHighlightedTitleColor" ref="134904318"/>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4zMTUyMTczOTEzIDAuMDA3NDMwODQ2NTgyIDAAA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="675870510"/>
<reference key="IBUINormalBackgroundImage" ref="858910736"/>
<reference key="IBUIFontDescription" ref="1003251016"/>
<reference key="IBUIFont" ref="892762088"/>
</object>
</array>
<string key="NSFrame">{{0, 20}, {320, 582}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="94214199"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MSAwLjkwMzYyNDMzNTUgMC44NTU0OTc1MzIAA</bytes>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<object class="IBUISimulatedSizeMetrics" key="IBUISimulatedDestinationMetrics">
<string key="IBUISimulatedSizeMetricsClass">IBUISimulatedFreeformSizeMetricsSentinel</string>
<string key="IBUIDisplayName">Freeform</string>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="191373211"/>
</object>
<int key="connectionID">3</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="191373211"/>
<reference key="destination" ref="372490531"/>
</object>
<int key="connectionID">18</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">OnRejectPressed</string>
<reference key="source" ref="815152589"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">21</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">OnThrowPressed</string>
<reference key="source" ref="934489006"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">22</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">OnCarouselPressed</string>
<reference key="source" ref="927190473"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">23</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">OnAssaultPressed</string>
<reference key="source" ref="290239366"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">24</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">OnOtherPressed</string>
<reference key="source" ref="339163673"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">25</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="471912133"/>
<reference key="destination" ref="372490531"/>
</object>
<int key="connectionID">20</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">OnSendAdditionalMessage</string>
<reference key="source" ref="435178514"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">26</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="975951072"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<array class="NSMutableArray" key="children">
<reference ref="94214199"/>
<reference ref="815152589"/>
<reference ref="934489006"/>
<reference ref="927190473"/>
<reference ref="290239366"/>
<reference ref="339163673"/>
<reference ref="435178514"/>
<reference ref="471912133"/>
<reference ref="710805769"/>
<reference ref="837776317"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">13</int>
<reference key="object" ref="435178514"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">12</int>
<reference key="object" ref="471912133"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">11</int>
<reference key="object" ref="710805769"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">9</int>
<reference key="object" ref="339163673"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">8</int>
<reference key="object" ref="290239366"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">7</int>
<reference key="object" ref="927190473"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">5</int>
<reference key="object" ref="94214199"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="934489006"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">4</int>
<reference key="object" ref="815152589"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">27</int>
<reference key="object" ref="837776317"/>
<reference key="parent" ref="191373211"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.CustomClassName">AlarmViewController</string>
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="1.CustomClassName">UIScrollView</string>
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="11.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="12.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="13.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="27.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="5.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="9.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">27</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">AlarmViewController</string>
<string key="superclassName">UIViewController</string>
<dictionary class="NSMutableDictionary" key="actions">
<string key="OnAssaultPressed">id</string>
<string key="OnCarouselPressed">id</string>
<string key="OnOtherPressed">id</string>
<string key="OnRejectPressed">id</string>
<string key="OnSendAdditionalMessage">id</string>
<string key="OnThrowPressed">id</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName">
<object class="IBActionInfo" key="OnAssaultPressed">
<string key="name">OnAssaultPressed</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="OnCarouselPressed">
<string key="name">OnCarouselPressed</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="OnOtherPressed">
<string key="name">OnOtherPressed</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="OnRejectPressed">
<string key="name">OnRejectPressed</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="OnSendAdditionalMessage">
<string key="name">OnSendAdditionalMessage</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="OnThrowPressed">
<string key="name">OnThrowPressed</string>
<string key="candidateClassName">id</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/AlarmViewController.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<real value="1296" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<string key="alarm_text.png">{280, 80}</string>
<string key="button_alarm.png">{240, 36}</string>
</dictionary>
<string key="IBCocoaTouchPluginVersion">1181</string>
</data>
</archive>

View File

@ -0,0 +1,61 @@
//
// AppDelegate.h
// k-observer-iphone
//
// Created by vvv ооо on 26.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
#import "NavigationControllerDelegate.h"
#import "ObserverClient.h"
@class ConnectViewController;
@class MainMenuViewController;
@class ProfileViewController;
@class AlarmViewController;
@class MapViewController;
@class MessagesViewController;
@class SendMessageViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate, CLLocationManagerDelegate>
{
}
@property (strong, nonatomic) UIWindow *window;
@property (strong, nonatomic) UINavigationController *navController;
@property (strong, nonatomic) ConnectViewController *connectViewController;
@property (strong, nonatomic) MainMenuViewController *mainMenuViewController;
@property (strong, nonatomic) ProfileViewController *profileViewController;
@property (strong, nonatomic) AlarmViewController *alarmViewController;
@property (strong, nonatomic) MapViewController *mapViewController;
@property (strong, nonatomic) MessagesViewController *messagesViewController;
@property (strong, nonatomic) SendMessageViewController *sendMessageViewController;
@property (strong, nonatomic) NavigationControllerDelegate *navigationControllerDelegate;
@property (strong, nonatomic) ObserverClient* observerClient;
@property (strong, nonatomic) CLLocationManager *locationManager;
@property (strong, nonatomic) UIActivityIndicatorView* spinner;
-(void)gotoMainMenu;
-(void)gotoMainMenuImmediate;
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation;
@end

View File

@ -0,0 +1,166 @@
//
// AppDelegate.m
// k-observer-iphone
//
// Created by vvv ооо on 26.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "AppDelegate.h"
#import "ConnectViewController.h"
#import "MainMenuViewController.h"
#import "ProfileViewController.h"
#import "AlarmViewController.h"
#import "MapViewController.h"
#import "MessagesViewController.h"
#import "SendMessageViewController.h"
AppDelegate* appDelegate;
@implementation AppDelegate
@synthesize window = _window;
@synthesize navController = _navController;
@synthesize connectViewController = _connectViewController;
@synthesize mainMenuViewController = _mainMenuViewController;
@synthesize profileViewController = _profileViewController;
@synthesize alarmViewController = _alarmViewController;
@synthesize mapViewController = _mapViewController;
@synthesize messagesViewController = _messagesViewController;
@synthesize sendMessageViewController = _sendMessageViewController;
@synthesize navigationControllerDelegate = _navigationControllerDelegate;
@synthesize spinner = _spinner;
@synthesize observerClient = _observerClient;
@synthesize locationManager = _locationManager;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.connectViewController = [[ConnectViewController alloc] initWithNibName:@"ConnectViewController" bundle:nil];
self.connectViewController.title = @"Вход";
self.mainMenuViewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController" bundle:nil];
self.mainMenuViewController.title = @"Главное меню";
self.profileViewController = [[ProfileViewController alloc] initWithNibName:@"ProfileViewController" bundle:nil];
self.profileViewController.title = @"Профиль";
self.profileViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.alarmViewController = [[AlarmViewController alloc] initWithNibName:@"AlarmViewController" bundle:nil];
self.alarmViewController.title = @"Тревога";
self.alarmViewController.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.mapViewController = [[MapViewController alloc] initWithNibName:@"MapViewController" bundle:nil];
self.mapViewController.title = @"Карта";
self.messagesViewController = [[MessagesViewController alloc] initWithNibName:@"MessagesViewController" bundle:nil];
self.messagesViewController.title = @"Сообщения";
self.sendMessageViewController = [[SendMessageViewController alloc] initWithNibName:@"SendMessageViewController" bundle:nil];
self.navigationControllerDelegate = [[NavigationControllerDelegate alloc] init];
self.navController = [[UINavigationController alloc] initWithRootViewController:self.connectViewController];
self.navController.delegate = self.navigationControllerDelegate;
self.window.rootViewController = self.navController;
[self.window makeKeyAndVisible];
self.observerClient = [[ObserverClient alloc] init];
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
self.locationManager.distanceFilter = kCLDistanceFilterNone; // whenever we move
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[self.locationManager startUpdatingLocation];
//Force lazy load
//[self.mapViewController view]; //NO
[self.alarmViewController view];
[self.profileViewController view];
[self.sendMessageViewController view];
[self.messagesViewController view];
appDelegate = self;
CGPoint p = self.connectViewController.view.center;
self.spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
[self.spinner setCenter:p]; // I do this because I'm in landscape mode
[self.connectViewController.view addSubview:self.spinner]; // spinner is not visible until started
return YES;
}
- (void)applicationWillResignActive:(UIApplication *)application
{
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}
- (void)applicationDidEnterBackground:(UIApplication *)application
{
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
- (void)applicationWillEnterForeground:(UIApplication *)application
{
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
-(void)gotoMainMenu
{
@autoreleasepool
{
[self performSelectorOnMainThread:@selector(gotoMainMenuImmediate) withObject:nil waitUntilDone:NO];
}
}
-(void)gotoMainMenuImmediate
{
@autoreleasepool
{
[self.spinner stopAnimating];
[self.navController pushViewController:self.mainMenuViewController animated:YES];
}
}
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
float lon = newLocation.coordinate.longitude;
float lat = newLocation.coordinate.latitude;
[appDelegate.observerClient UpdateLon:lon Lat:lat];
}
@end

View File

@ -0,0 +1,26 @@
//
// ViewController.h
// k-observer-iphone
//
// Created by vvv ооо on 26.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ConnectViewController : UIViewController<UITextFieldDelegate>
- (IBAction)OnConnectPressed;
- (BOOL)textFieldShouldReturn:(UITextField *)textField;
-(void)UnlockConnectButton;
-(void)OnConnectionClosed;
-(void)OnConnectionClosedImmediate;
-(void)OnReceiveQuit;
-(void)OnReceiveQuitImmediate;
@end

View File

@ -0,0 +1,109 @@
//
// ViewController.m
// k-observer-iphone
//
// Created by vvv ооо on 26.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "ConnectViewController.h"
#import "MainMenuViewController.h"
#import "AppDelegate.h"
extern AppDelegate* appDelegate;
@interface ConnectViewController ()
@end
@implementation ConnectViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (IBAction)OnConnectPressed
{
[appDelegate.spinner startAnimating];
UITextField* address_tf = (UITextField*)[self.view viewWithTag:1];
UITextField* port_tf = (UITextField*)[self.view viewWithTag:2];
UIButton* btn_connect = (UIButton*)[self.view viewWithTag:3];
[appDelegate.observerClient ConnectTo:address_tf.text onPort:port_tf.text];
[btn_connect setUserInteractionEnabled:NO];
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[self.view endEditing:YES];
return YES;
}
-(void)UnlockConnectButton
{
UIButton* btn_connect = (UIButton*)[self.view viewWithTag:3];
[btn_connect setUserInteractionEnabled:YES];
}
-(void)OnConnectionClosed
{
[self performSelectorOnMainThread:@selector(OnConnectionClosedImmediate) withObject:nil waitUntilDone:NO];
}
-(void)OnReceiveQuit
{
[self performSelectorOnMainThread:@selector(OnReceiveQuitImmediate) withObject:nil waitUntilDone:NO];
}
-(void)OnReceiveQuitImmediate
{
@autoreleasepool {
UIAlertView *message = [[UIAlertView alloc] initWithTitle:@"Сервер недоступен"
message:@"Сервер недоступен"
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[message show];
[appDelegate.spinner stopAnimating];
[appDelegate.connectViewController UnlockConnectButton];
[appDelegate.navController popToRootViewControllerAnimated:YES];
}
}
-(void)OnConnectionClosedImmediate
{
[appDelegate.spinner stopAnimating];
[appDelegate.connectViewController UnlockConnectButton];
}
@end

View File

@ -0,0 +1,19 @@
//
// MainMenuViewController.h
// k-observer-iphone
//
// Created by vvv ооо on 26.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MainMenuViewController : UIViewController
- (IBAction)OnMapButtonPressed;
- (IBAction)OnProfileButtonPressed;
- (IBAction)OnAlarmButtonPressed;
- (IBAction)OnMessagesButtonPressed;
-(void)viewDidAppear:(BOOL)animated;
@end

View File

@ -0,0 +1,78 @@
//
// MainMenuViewController.m
// k-observer-iphone
//
// Created by vvv ооо on 26.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "MainMenuViewController.h"
#import "ProfileViewController.h"
#import "AlarmViewController.h"
#import "MapViewController.h"
#import "MessagesViewController.h"
#import "AppDelegate.h"
extern AppDelegate* appDelegate;
@interface MainMenuViewController ()
@end
@implementation MainMenuViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
-(void)viewDidAppear:(BOOL)animated
{
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (IBAction)OnMapButtonPressed
{
//[self.view addSubview:appDelegate.mapViewController.view];
[appDelegate.navController pushViewController:appDelegate.mapViewController animated:YES];
}
- (IBAction)OnProfileButtonPressed
{
//[self.view addSubview:appDelegate.profileViewController.view];
[appDelegate.navController pushViewController:appDelegate.profileViewController animated:YES];
}
- (IBAction)OnAlarmButtonPressed
{
//[self.view addSubview:appDelegate.alarmViewController.view];
[appDelegate.navController pushViewController:appDelegate.alarmViewController animated:YES];
}
- (IBAction)OnMessagesButtonPressed
{
//[self.view addSubview:appDelegate.messagesViewController.view];
[appDelegate.navController pushViewController:appDelegate.messagesViewController animated:YES];
}
@end

View File

@ -0,0 +1,329 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1296</int>
<string key="IBDocument.SystemVersion">11E53</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">1181</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBUIButton</string>
<string>IBUIView</string>
<string>IBUILabel</string>
<string>IBProxyObject</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="975951072">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUIButton" id="572807675">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{40, 75}, {240, 36}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSNextKeyView" ref="943522285"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Открыть карту</string>
<object class="NSColor" key="IBUIHighlightedTitleColor" id="223753225">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleShadowColor" id="707694074">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC41AA</bytes>
</object>
<object class="NSCustomResource" key="IBUINormalBackgroundImage" id="646946963">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">button.png</string>
</object>
<object class="IBUIFontDescription" key="IBUIFontDescription" id="1065435407">
<int key="type">2</int>
<double key="pointSize">15</double>
</object>
<object class="NSFont" key="IBUIFont" id="508787100">
<string key="NSName">Helvetica-Bold</string>
<double key="NSSize">15</double>
<int key="NSfFlags">16</int>
</object>
</object>
<object class="IBUIButton" id="943522285">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{40, 141}, {240, 36}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSNextKeyView" ref="940452872"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Изменить профиль</string>
<reference key="IBUIHighlightedTitleColor" ref="223753225"/>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="707694074"/>
<reference key="IBUINormalBackgroundImage" ref="646946963"/>
<reference key="IBUIFontDescription" ref="1065435407"/>
<reference key="IBUIFont" ref="508787100"/>
</object>
<object class="IBUIButton" id="940452872">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{40, 207}, {240, 36}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSNextKeyView" ref="178073242"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Подать сигнал тревоги</string>
<reference key="IBUIHighlightedTitleColor" ref="223753225"/>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4zMTUyMTczOTEzIDAuMDA3NDMwODQ2NTgyIDAAA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="707694074"/>
<object class="NSCustomResource" key="IBUINormalBackgroundImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">button_alarm.png</string>
</object>
<reference key="IBUIFontDescription" ref="1065435407"/>
<reference key="IBUIFont" ref="508787100"/>
</object>
<object class="IBUIButton" id="178073242">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{40, 273}, {240, 36}}</string>
<reference key="NSSuperview" ref="191373211"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Посмотреть сообщения</string>
<reference key="IBUIHighlightedTitleColor" ref="223753225"/>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="707694074"/>
<reference key="IBUINormalBackgroundImage" ref="646946963"/>
<reference key="IBUIFontDescription" ref="1065435407"/>
<reference key="IBUIFont" ref="508787100"/>
</object>
<object class="IBUILabel" id="39019216">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{40, 28}, {245, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSNextKeyView" ref="572807675"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Панель управления К-Выборы</string>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<object class="IBUIFontDescription" key="IBUIFontDescription">
<int key="type">1</int>
<double key="pointSize">17</double>
</object>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica</string>
<double key="NSSize">17</double>
<int key="NSfFlags">16</int>
</object>
</object>
</array>
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
<reference key="NSSuperview"/>
<reference key="NSNextKeyView" ref="39019216"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC44NDUzMDkwODU0IDAuOTI2MjM3MDMwNCAxAA</bytes>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="191373211"/>
</object>
<int key="connectionID">3</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">OnMapButtonPressed</string>
<reference key="source" ref="572807675"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">10</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">OnProfileButtonPressed</string>
<reference key="source" ref="943522285"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">8</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">OnAlarmButtonPressed</string>
<reference key="source" ref="940452872"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">9</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">OnMessagesButtonPressed</string>
<reference key="source" ref="178073242"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">11</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<array class="NSMutableArray" key="children">
<reference ref="572807675"/>
<reference ref="943522285"/>
<reference ref="940452872"/>
<reference ref="178073242"/>
<reference ref="39019216"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="975951072"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">4</int>
<reference key="object" ref="572807675"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">5</int>
<reference key="object" ref="943522285"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="940452872"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">7</int>
<reference key="object" ref="178073242"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">12</int>
<reference key="object" ref="39019216"/>
<reference key="parent" ref="191373211"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.CustomClassName">MainMenuViewController</string>
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="12.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="5.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">12</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<real value="1296" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<string key="button.png">{480, 72}</string>
<string key="button_alarm.png">{480, 72}</string>
</dictionary>
<string key="IBCocoaTouchPluginVersion">1181</string>
</data>
</archive>

View File

@ -0,0 +1,30 @@
//
// MapViewController.h
// k-observer-iphone
//
// Created by vvv ооо on 26.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
//#import <UIKit/UIControl.h>
@interface MapViewController : UIViewController<UIWebViewDelegate>
@property (nonatomic, retain) NSTimer *MapRefreshTimer;
@property (strong, nonatomic) UIActivityIndicatorView* spinner;
- (void)viewDidAppear:(BOOL)animated;
- (void)viewDidDisappear:(BOOL)animated;
-(void)refreshMap;
- (void) onAlarmSelectorChanged;
- (void)webViewDidFinishLoad:(UIWebView *)webView;
@end

View File

@ -0,0 +1,234 @@
//
// MapViewController.m
// k-observer-iphone
//
// Created by vvv ооо on 26.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "MapViewController.h"
#import "AppDelegate.h"
#include "ObserverClientCpp.h"
//extern boost::mutex UpdatingMapMutex;
//extern std::vector<TUserInfo> UserInfoArr;
//extern std::vector<TUserInfo> AlarmUserInfoArr;
/*
void SwitchMapToAlarm();
void SwitchMapToCommon();
bool IsAlarmMap();*/
extern TObserverClient ObserverClientClass;
extern AppDelegate* appDelegate;
@interface MapViewController ()
@end
@implementation MapViewController
@synthesize MapRefreshTimer = _MapRefreshTimer;
@synthesize spinner = _spinner;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
UISegmentedControl* segmentedControl = (UISegmentedControl*)[self.view viewWithTag:3];
[segmentedControl addTarget:self action:@selector(onAlarmSelectorChanged) forControlEvents:UIControlEventValueChanged];
UIWebView* webView = (UIWebView*)[self.view viewWithTag:2];
NSString* filePath = [[NSBundle mainBundle] pathForResource:@"script" ofType:@"html"];
NSString *htmlString = [NSString stringWithContentsOfFile:filePath encoding:NSUTF8StringEncoding error:nil];
NSString* lon_str = [NSString stringWithFormat:@"%f", [appDelegate.observerClient GetBaseLon]];
NSString* lat_str = [NSString stringWithFormat:@"%f", [appDelegate.observerClient GetBaseLat]];
NSString* zoom_str = [NSString stringWithFormat:@"%d", [appDelegate.observerClient GetBaseZoom]];
htmlString = [htmlString stringByReplacingOccurrencesOfString:@"<<<LON>>>" withString:lon_str];
htmlString = [htmlString stringByReplacingOccurrencesOfString:@"<<<LAT>>>" withString:lat_str];
htmlString = [htmlString stringByReplacingOccurrencesOfString:@"<<<ZOOM>>>" withString:zoom_str];
[webView loadHTMLString:htmlString baseURL:nil];
[webView setDelegate:self];
CGPoint p = webView.center;
self.spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
[self.spinner setCenter:p]; // I do this because I'm in landscape mode
[webView addSubview:self.spinner]; // spinner is not visible until started
[self.spinner startAnimating];
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)viewDidAppear:(BOOL)animated
{
[appDelegate.observerClient StartMapHeartbeatTimer];
self.MapRefreshTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(refreshMap) userInfo:nil repeats:YES];
}
- (void)viewDidDisappear:(BOOL)animated
{
[appDelegate.observerClient StopMapHeartbeatTimer];
self.MapRefreshTimer = nil;
}
-(void)refreshMap
{
ObserverClientClass.UpdatingMapMutex.lock();
UIWebView* webView = (UIWebView*)[self.view viewWithTag:2];
[webView stringByEvaluatingJavaScriptFromString:@"Clear();"];
if ([appDelegate.observerClient IsAlarmMap])
{
for (std::vector<TUserInfo>::iterator i = ObserverClientClass.AlarmUserInfoArr.begin(); i != ObserverClientClass.AlarmUserInfoArr.end(); ++i)
{
NSString* posX = [NSString stringWithFormat:@"%f", i->PosX];
NSString* posY = [NSString stringWithFormat:@"%f", i->PosY];
NSString* mapState = [NSString stringWithFormat:@"%d", i->MapState];
NSString* State;
if (i->MapState == 0)
{
State = @"Мобильная группа";
}
else if (i->MapState == 1)
{
State = @"Наблюдатель";
}
else if (i->MapState == 2)
{
State = @"Тревога";
}
else if (i->MapState == 3)
{
State = @"Тревога - Удаление с УИК";
}
else if (i->MapState == 4)
{
State = @"Тревога - Вброс";
}
else if (i->MapState == 5)
{
State = @"Тревога - Карусель";
}
else if (i->MapState == 6)
{
State = @"Тревога - Нападение";
}
else
{
State = @"Тревога";
}
NSString* text = [NSString stringWithFormat:@"УИК № %d \\n %@ \\n %@ \\n %@ \\n %@ \\n Состояние: %@",
i->Uik,
[NSString stringWithCString:i->LastName.c_str() encoding:NSUTF8StringEncoding],
[NSString stringWithCString:i->FirstName.c_str() encoding:NSUTF8StringEncoding],
[NSString stringWithCString:i->MiddleName.c_str() encoding:NSUTF8StringEncoding],
[NSString stringWithCString:i->PhoneNumber.c_str() encoding:NSUTF8StringEncoding],
State];
if (i->PosX != 0.f && i->PosY != 0.f)
{
NSString* javaScriptCode = [NSString stringWithFormat:@"AddMarkerWithPopup(%@, %@, %@, \"%@\");", posX, posY, mapState, text];
[webView stringByEvaluatingJavaScriptFromString:javaScriptCode];
}
}
}
else
{
for (std::vector<TUserInfo>::iterator i = ObserverClientClass.UserInfoArr.begin(); i != ObserverClientClass.UserInfoArr.end(); ++i)
{
NSString* posX = [NSString stringWithFormat:@"%f", i->PosX];
NSString* posY = [NSString stringWithFormat:@"%f", i->PosY];
NSString* mapState = [NSString stringWithFormat:@"%d", i->MapState];
if (i->PosX != 0.f && i->PosY != 0.f)
{
NSString* javaScriptCode = [NSString stringWithFormat:@"AddMarker(%@, %@, %@);", posX, posY, mapState];
[webView stringByEvaluatingJavaScriptFromString:javaScriptCode];
}
}
}
ObserverClientClass.UpdatingMapMutex.unlock();
}
- (void) onAlarmSelectorChanged
{
UISegmentedControl* segmentedControl = (UISegmentedControl*)[self.view viewWithTag:3];
UIWebView* webView = (UIWebView*)[self.view viewWithTag:2];
if (segmentedControl.selectedSegmentIndex == 0)
{
[appDelegate.observerClient SwitchMapToCommon];
[webView stringByEvaluatingJavaScriptFromString:@"DeactivateSelectControl();"];
}
else
{
[appDelegate.observerClient SwitchMapToAlarm];
[webView stringByEvaluatingJavaScriptFromString:@"ActivateSelectControl();"];
}
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
[self.spinner stopAnimating];
}
@end

View File

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1296</int>
<string key="IBDocument.SystemVersion">11E53</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">1181</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBUIWebView</string>
<string>IBUISegmentedControl</string>
<string>IBUIView</string>
<string>IBProxyObject</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="975951072">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUIWebView" id="175458418">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">274</int>
<string key="NSFrameSize">{320, 460}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSNextKeyView" ref="890066521"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC44NDUzMDkwODU0IDAuOTI2MjM3MDMwNCAxAA</bytes>
</object>
<int key="IBUITag">2</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIDataDetectorTypes">1</int>
<bool key="IBUIDetectsPhoneNumbers">YES</bool>
</object>
<object class="IBUISegmentedControl" id="890066521">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{57, 360}, {207, 44}}</string>
<reference key="NSSuperview" ref="191373211"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<int key="IBUITag">3</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBNumberOfSegments">2</int>
<int key="IBSelectedSegmentIndex">0</int>
<array key="IBSegmentTitles">
<string>Все</string>
<string>Тревога</string>
</array>
<array class="NSMutableArray" key="IBSegmentWidths">
<real value="0.0"/>
<real value="0.0"/>
</array>
<array class="NSMutableArray" key="IBSegmentEnabledStates">
<boolean value="YES"/>
<boolean value="YES"/>
</array>
<array class="NSMutableArray" key="IBSegmentContentOffsets">
<string>{0, 0}</string>
<string>{0, 0}</string>
</array>
<array class="NSMutableArray" key="IBSegmentImages">
<object class="NSNull" id="4"/>
<reference ref="4"/>
</array>
</object>
</array>
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
<reference key="NSSuperview"/>
<reference key="NSNextKeyView" ref="175458418"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC44NDUzMDkwODU0IDAuOTI2MjM3MDMwNCAxAA</bytes>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="191373211"/>
</object>
<int key="connectionID">3</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<array class="NSMutableArray" key="children">
<reference ref="175458418"/>
<reference ref="890066521"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="975951072"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">4</int>
<reference key="object" ref="175458418"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="890066521"/>
<reference key="parent" ref="191373211"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.CustomClassName">MapViewController</string>
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">6</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<real value="1296" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">1181</string>
</data>
</archive>

View File

@ -0,0 +1,28 @@
//
// MessagesViewController.h
// k-observer-iphone
//
// Created by vvv ооо on 26.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MessagesViewController : UIViewController<UITableViewDelegate>
{
NSMutableArray* messageHeadersArray;
NSMutableArray* messageArray;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView;
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;
-(void)addMessage:(NSString*)message withHeader:(NSString*)header;
@end

View File

@ -0,0 +1,137 @@
//
// MessagesViewController.m
// k-observer-iphone
//
// Created by vvv ооо on 26.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "MessagesViewController.h"
#import "AppDelegate.h"
extern AppDelegate* appDelegate;
@interface MessagesViewController ()
@end
@implementation MessagesViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
messageHeadersArray = [[NSMutableArray alloc] init];
messageArray = [[NSMutableArray alloc] init];
[messageHeadersArray addObject:@"Подключение установлено"];
[messageArray addObject:@"Подключение к серверу успешно установлено"];
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
NSArray* iparr = [NSArray arrayWithObjects:[NSIndexPath indexPathWithIndex:0], [NSIndexPath indexPathWithIndex:1], nil];
UITableView* tableView = (UITableView*)[self.view viewWithTag:4];
[tableView insertRowsAtIndexPaths:iparr withRowAnimation:UITableViewRowAnimationAutomatic];
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
-(void)viewDidAppear:(BOOL)animated
{
UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Отправить" style:UIBarButtonItemStylePlain target:self action:@selector(goToSendMessageView)];
self.navigationItem.rightBarButtonItem = anotherButton;
}
-(void)viewDidDisappear:(BOOL)animated
{
self.navigationItem.rightBarButtonItem = nil;
}
-(void)goToSendMessageView
{
self.navigationItem.rightBarButtonItem = nil;
[appDelegate.navController pushViewController:(UIViewController*)appDelegate.sendMessageViewController animated:YES];
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [messageHeadersArray count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
//Поиск ячейки
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
//Если ячейка не найдена
if (cell == nil) {
//Создание ячейки
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
;
cell.textLabel.text = [messageHeadersArray objectAtIndex:messageHeadersArray.count-indexPath.row-1];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITextView* textView = (UITextView*)[[self.view viewWithTag:1] viewWithTag:2];
[textView setText:[messageArray objectAtIndex:messageHeadersArray.count-indexPath.row-1]];
}
-(void)addMessage:(NSString*)message withHeader:(NSString*)header
{
UITableView* tableView = (UITableView*)[self.view viewWithTag:4];
[messageHeadersArray addObject:header];
[messageArray addObject:message];
[tableView reloadData];
[tableView performSelectorOnMainThread:@selector(reloadData) withObject:nil waitUntilDone:NO];
}
@end

View File

@ -0,0 +1,300 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1296</int>
<string key="IBDocument.SystemVersion">11E53</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">1181</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
<string>IBUIImageView</string>
<string>IBUILabel</string>
<string>IBUITextView</string>
<string>IBUITableView</string>
<string>IBUIScrollView</string>
<string>IBUIView</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="975951072">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUIScrollView" id="771679320">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">268</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUIImageView" id="168758211">
<reference key="NSNextResponder" ref="771679320"/>
<int key="NSvFlags">292</int>
<string key="NSFrameSize">{320, 186}</string>
<reference key="NSSuperview" ref="771679320"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="473124447"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSCustomResource" key="IBUIImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">messages_text.png</string>
</object>
</object>
<object class="IBUITextView" id="473124447">
<reference key="NSNextResponder" ref="771679320"/>
<int key="NSvFlags">274</int>
<string key="NSFrameSize">{320, 186}</string>
<reference key="NSSuperview" ref="771679320"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="207728204"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUITag">2</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIEditable">NO</bool>
<string key="IBUIText"/>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<int key="IBUIAutocapitalizationType">2</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIFontDescription" key="IBUIFontDescription">
<int key="type">1</int>
<double key="pointSize">14</double>
</object>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica</string>
<double key="NSSize">14</double>
<int key="NSfFlags">16</int>
</object>
</object>
</array>
<string key="NSFrame">{{0, 84}, {320, 186}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="168758211"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
<int key="IBUITag">1</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUITableView" id="207728204">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">274</int>
<string key="NSFrame">{{0, 229}, {320, 231}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC44NDUzMDkwODU0IDAuOTI2MjM3MDMwNCAxAA</bytes>
</object>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUITag">4</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIAlwaysBounceVertical">YES</bool>
<int key="IBUISeparatorStyle">1</int>
<object class="NSColor" key="IBUISeparatorColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC43ODgwNDM0NzgzIDAuNzg4MDQzNDc4MyAwLjc4ODA0MzQ3ODMAA</bytes>
</object>
<int key="IBUISectionIndexMinimumDisplayRowCount">0</int>
<bool key="IBUIShowsSelectionImmediatelyOnTouchBegin">YES</bool>
<float key="IBUIRowHeight">44</float>
<float key="IBUISectionHeaderHeight">22</float>
<float key="IBUISectionFooterHeight">22</float>
</object>
<object class="IBUILabel" id="822518612">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 12}, {190, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="771679320"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Выбранное сообщение:</string>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<object class="IBUIFontDescription" key="IBUIFontDescription">
<int key="type">1</int>
<double key="pointSize">17</double>
</object>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica</string>
<double key="NSSize">17</double>
<int key="NSfFlags">16</int>
</object>
</object>
</array>
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="822518612"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC44NDUzMDkwODU0IDAuOTI2MjM3MDMwNCAxAA</bytes>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="191373211"/>
</object>
<int key="connectionID">3</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">dataSource</string>
<reference key="source" ref="207728204"/>
<reference key="destination" ref="372490531"/>
</object>
<int key="connectionID">12</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="207728204"/>
<reference key="destination" ref="372490531"/>
</object>
<int key="connectionID">11</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<array class="NSMutableArray" key="children">
<reference ref="771679320"/>
<reference ref="207728204"/>
<reference ref="822518612"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="975951072"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">7</int>
<reference key="object" ref="771679320"/>
<array class="NSMutableArray" key="children">
<reference ref="168758211"/>
<reference ref="473124447"/>
</array>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">10</int>
<reference key="object" ref="473124447"/>
<reference key="parent" ref="771679320"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">13</int>
<reference key="object" ref="168758211"/>
<reference key="parent" ref="771679320"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="207728204"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">14</int>
<reference key="object" ref="822518612"/>
<reference key="parent" ref="191373211"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.CustomClassName">MessagesViewController</string>
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="10.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="13.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="14.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">14</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">MessagesViewController</string>
<string key="superclassName">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/MessagesViewController.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<real value="1296" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<string key="NS.key.0">messages_text.png</string>
<string key="NS.object.0">{640, 372}</string>
</object>
<string key="IBCocoaTouchPluginVersion">1181</string>
</data>
</archive>

View File

@ -0,0 +1,17 @@
//
// NavigationControllerDelegate.h
// k-observer-iphone
//
// Created by vvv ооо on 27.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface NavigationControllerDelegate : NSObject<UINavigationControllerDelegate>
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated;
@end

View File

@ -0,0 +1,58 @@
//
// NavigationControllerDelegate.m
// k-observer-iphone
//
// Created by vvv ооо on 27.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "NavigationControllerDelegate.h"
#import "AppDelegate.h"
#import "ConnectViewController.h"
#import "MainMenuViewController.h"
#import "ProfileViewController.h"
#import "AlarmViewController.h"
#import "MapViewController.h"
#import "MessagesViewController.h"
extern AppDelegate* appDelegate;
@implementation NavigationControllerDelegate
- (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
if (viewController == appDelegate.connectViewController)
{
[appDelegate.observerClient Close];
}
if (viewController == appDelegate.mainMenuViewController)
{
}
if (viewController == appDelegate.profileViewController)
{
}
if (viewController == appDelegate.alarmViewController)
{
}
if (viewController == appDelegate.mapViewController)
{
}
if (viewController == appDelegate.messagesViewController)
{
}
}
@end

View File

@ -0,0 +1,59 @@
//
// ObserverClient.h
// k-observer-iphone
//
// Created by vvv ооо on 27.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ObserverClient : NSObject
{
BOOL Active;
float CurrentLon;
float CurrentLat;
}
-(void)ConnectTo:(NSString*)address onPort:(NSString*)port;
-(void)StopTryingConnect;
-(void)Close;
-(void)UpdateProfileWithLastName:(NSString*)lastName
FirstName:(NSString*)firstName
MiddleName:(NSString*)middleName
PhoneNumber:(NSString*)phoneNumber
UikNumber:(int)uikNumber
Status:(int)status;
-(void)SetMapState:(int)mode;
-(int)GetMapState;
-(void)UpdateLon:(float)lon Lat:(float)lat;
-(void)PassLonLatToClient;
-(void)StartHeartbeatTimer;
-(void)StopHeartbeatTimer;
-(void)StartMapHeartbeatTimer;
-(void)StopMapHeartbeatTimer;
-(void)SendMessage:(NSString*)msg;
-(float)GetBaseLon;
-(float)GetBaseLat;
-(int)GetBaseZoom;
-(void)SwitchMapToAlarm;
-(void)SwitchMapToCommon;
-(bool)IsAlarmMap;
@end

View File

@ -0,0 +1,261 @@
//
// ObserverClient.m
// k-observer-iphone
//
// Created by vvv ооо on 27.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "ObserverClient.h"
#import "AppDelegate.h"
#import "MessagesViewController.h"
#import "ConnectViewController.h"
#include "ObserverClientCpp.h"
extern AppDelegate* appDelegate;
TObserverClient ObserverClientClass;
@implementation ObserverClient
-(id)init
{
self = [super init];
if (self)
{
Active = NO;
CurrentLon = 0.f;
CurrentLat = 0.f;
}
return self;
}
-(void)ConnectTo:(NSString*)address onPort:(NSString*)port
{
if (!Active)
{
const char* c_address = [address UTF8String];
const char* c_port = [port UTF8String];
ObserverClientClass.CreateClientSocket(c_address, c_port);
}
}
-(void)StopTryingConnect
{
ObserverClientClass.DestroyClientSocket();
[appDelegate.spinner stopAnimating];
UIButton* btn_connect = (UIButton*)[appDelegate.connectViewController.view viewWithTag:3];
UIButton* btn_cancel = (UIButton*)[appDelegate.connectViewController.view viewWithTag:4];
[btn_connect setUserInteractionEnabled:YES];
[btn_cancel setUserInteractionEnabled:NO];
}
-(void)ConnectAutorizationFinished
{
if (!Active)
{
[self StartHeartbeatTimer];
[self PassLonLatToClient];
Active = YES;
}
}
-(void)Close
{
if (Active)
{
[self StopHeartbeatTimer];
ObserverClientClass.ClientSocket->BlockForceCloseMessage = true;
ObserverClientClass.DestroyClientSocket();
Active = NO;
}
}
-(void)UpdateProfileWithLastName:(NSString*)lastName
FirstName:(NSString*)firstName
MiddleName:(NSString*)middleName
PhoneNumber:(NSString*)phoneNumber
UikNumber:(int)uikNumber
Status:(int)status
{
const char* c_lastName = [lastName UTF8String];
const char* c_firstName = [firstName UTF8String];
const char* c_middleName = [middleName UTF8String];
const char* c_phoneNumber = [phoneNumber UTF8String];
ObserverClientClass.UpdateUserInfo(c_lastName, c_firstName, c_middleName, c_phoneNumber, uikNumber, status);
}
-(void)SetMapState:(int)mode
{
ObserverClientClass.ClientSocket->UserInfo.MapState = mode;
}
-(int)GetMapState
{
return ObserverClientClass.ClientSocket->UserInfo.MapState;
}
-(void)UpdateLon:(float)lon Lat:(float)lat
{
CurrentLon = lon;
CurrentLat = lat;
if (Active)
{
[self PassLonLatToClient];
}
}
-(void)PassLonLatToClient
{
ObserverClientClass.ClientSocket->UserInfo.PosX = CurrentLon;
ObserverClientClass.ClientSocket->UserInfo.PosY = CurrentLat;
}
-(void)StartHeartbeatTimer
{
ObserverClientClass.RestartHeartbeatTimer();
}
-(void)StopHeartbeatTimer
{
ObserverClientClass.HeartbeatTimer->cancel();
}
-(void)StartMapHeartbeatTimer
{
ObserverClientClass.RestartMapHeartbeatTimer();
}
-(void)StopMapHeartbeatTimer
{
ObserverClientClass.MapHeartbeatTimer->cancel();
}
-(void)SendMessage:(NSString*)msg
{
const char* c_msg = [msg UTF8String];
ObserverClientClass.SendMessage(c_msg);
}
-(float)GetBaseLon
{
return ObserverClientClass.ClientSocket->BaseLon;
}
-(float)GetBaseLat
{
return ObserverClientClass.ClientSocket->BaseLat;
}
-(int)GetBaseZoom
{
return ObserverClientClass.ClientSocket->BaseZoom;
}
-(void)SwitchMapToAlarm
{
ObserverClientClass.SwitchMapToAlarm();
}
-(void)SwitchMapToCommon
{
ObserverClientClass.SwitchMapToCommon();
}
-(bool)IsAlarmMap
{
return ObserverClientClass.IsAlarmMap();
}
@end
void AppDelegateSendOnConnectionClosed()
{
[appDelegate.connectViewController OnConnectionClosed];
}
void AppDelegateSendOnReceiveQuit()
{
[appDelegate.connectViewController OnReceiveQuit];
}
void AppDelegateAddNewMessage(TUserInfo userInfo, std::string message)
{
@autoreleasepool {
NSString* str_msg = [NSString stringWithCString:message.c_str() encoding:NSUTF8StringEncoding];
NSString* str_header;
if (userInfo.MapState != 0)
{
str_header = [NSString stringWithFormat:@"%d %@", userInfo.Uik, str_msg];
}
else
{
str_header = [NSString stringWithFormat:@"(МГ) %@", str_msg];
}
NSString* lastName = [NSString stringWithCString:userInfo.LastName.c_str() encoding:NSUTF8StringEncoding];
NSString* firstName = [NSString stringWithCString:userInfo.FirstName.c_str() encoding:NSUTF8StringEncoding];
NSString* middleName = [NSString stringWithCString:userInfo.MiddleName.c_str() encoding:NSUTF8StringEncoding];
NSString* phoneNumber = [NSString stringWithCString:userInfo.PhoneNumber.c_str() encoding:NSUTF8StringEncoding];
NSString* status;
if (userInfo.MapState == 0)
{
status = @"Мобильная группа";
}
else
{
status = @"Наблюдатель";
}
if (userInfo.MapState != 0)
{
str_msg = [NSString stringWithFormat:@"УИК %d, %@ %@ %@ %@ %@: %@", userInfo.Uik, lastName, firstName, middleName, phoneNumber, status, str_msg];
}
else
{
str_msg = [NSString stringWithFormat:@"(МГ), %@ %@ %@ %@ %@: %@", lastName, firstName, middleName, phoneNumber, status, str_msg];
}
[appDelegate.messagesViewController addMessage:str_msg withHeader:str_header];
}
}
void AppDelegateOnAutorizationSend()
{
[appDelegate gotoMainMenu];
[appDelegate.observerClient ConnectAutorizationFinished];
}

View File

@ -0,0 +1,198 @@
//
// ObserverClientCpp.cpp
// k-observer-iphone
//
// Created by vvv ооо on 06.09.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#include <iostream>
#include "ObserverClientCpp.h"
TObserverClient::TObserverClient()
: MapType(0)
{
}
void TObserverClient::DestroyClientSocket()
{
ClientSocket->CloseImmediate();
}
void TObserverClient::IoServiceRun()
{
IoService.run();
ReceiveCloseSignal();
ReceiveCloseSignal.disconnect_all_slots();
}
void TObserverClient::CreateClientSocket(const char* address, const char* port)
{
ClientSocket = boost::shared_ptr<TClientSocket>(new TClientSocket(IoService));
ClientSocket->ReceiveMapSignal.connect(boost::bind(&TObserverClient::OnReceiveMapUpdate, this, _1));
ClientSocket->ReceiveAlarmMapSignal.connect(boost::bind(&TObserverClient::OnReceiveAlarmMapUpdate, this, _1));
ClientSocket->ReceiveMessageSignal.connect(boost::bind(&TObserverClient::OnReceiveMessage, this, _1, _2));
ClientSocket->ReceiveAutorizationSentSignal.connect(boost::bind(&TObserverClient::OnAutorizationSend, this));
ReceiveCloseSignal.connect(boost::bind(&TObserverClient::OnCloseSocket, this));
ClientSocket->ReceiveForceCloseSignal.connect(boost::bind(&TObserverClient::OnReceiveQuit, this));
ClientSocket->Open(std::string(address), std::string(port));
IoServiceThread = boost::thread(boost::bind(&TObserverClient::IoServiceRun, this));
}
void TObserverClient::OnAutorizationSend()
{
AppDelegateOnAutorizationSend();
}
void TObserverClient::UpdateUserInfo(const char* lastName,
const char* firstName,
const char* middleName,
const char* phoneNumber,
int uik,
int status)
{
ClientSocket->UserInfo.LastName = std::string(lastName);
ClientSocket->UserInfo.FirstName = std::string(firstName);
ClientSocket->UserInfo.MiddleName = std::string(middleName);
ClientSocket->UserInfo.PhoneNumber = std::string(phoneNumber);
ClientSocket->UserInfo.Uik = uik;
ClientSocket->UserInfo.Status = status;
if (status == 1)
{
ClientSocket->UserInfo.MapState = 0;
}
ClientSocket->SendUserinfoUpdateThreaded();
}
void TObserverClient::RestartHeartbeatTimer()
{
HeartbeatTimer = boost::shared_ptr<boost::asio::deadline_timer>(new boost::asio::deadline_timer(IoService, boost::posix_time::milliseconds(500)));
HeartbeatTimer->async_wait(boost::bind(&TObserverClient::OnHeartbeat, this, boost::asio::placeholders::error));
}
void TObserverClient::RestartMapHeartbeatTimer()
{
MapHeartbeatTimer = boost::shared_ptr<boost::asio::deadline_timer>(new boost::asio::deadline_timer(IoService, boost::posix_time::milliseconds(500)));
MapHeartbeatTimer->async_wait(boost::bind(&TObserverClient::OnMapHeartbeat, this, boost::asio::placeholders::error));
}
void TObserverClient::OnHeartbeat(const boost::system::error_code& e)
{
if (e)
{
return;
}
ClientSocket->SendHeartbeatThreaded();
RestartHeartbeatTimer();
}
void TObserverClient::OnMapHeartbeat(const boost::system::error_code& e)
{
if (e)
{
return;
}
if (MapType == 0)
{
ClientSocket->SendMapQueryThreaded();
}
else
{
ClientSocket->SendAlarmMapQueryThreaded();
}
RestartMapHeartbeatTimer();
}
void TObserverClient::OnReceiveMapUpdate(std::vector<TUserInfo> userInfoArr)
{
UpdatingMapMutex.lock();
UserInfoArr = userInfoArr;
UpdatingMapMutex.unlock();
}
void TObserverClient::SwitchMapToAlarm()
{
MapType = 1;
}
void TObserverClient::SwitchMapToCommon()
{
MapType = 0;
}
bool TObserverClient::IsAlarmMap()
{
return MapType == 1;
}
void TObserverClient::OnReceiveAlarmMapUpdate(std::vector<TUserInfo> userInfoArr)
{
UpdatingMapMutex.lock();
AlarmUserInfoArr = userInfoArr;
UpdatingMapMutex.unlock();
}
void TObserverClient::OnReceiveMessage(TUserInfo userInfo, std::string message)
{
AppDelegateAddNewMessage(userInfo, message);
}
void TObserverClient::SendMessage(const char* msg)
{
std::string message(msg);
ClientSocket->SendMessageThreaded(message);
}
void TObserverClient::OnCloseSocket()
{
ClientSocket = boost::shared_ptr<TClientSocket>();
IoService.reset();
AppDelegateSendOnConnectionClosed();
}
void TObserverClient::OnReceiveQuit()
{
AppDelegateSendOnReceiveQuit();
}

View File

@ -0,0 +1,94 @@
//
// ObserverClientCpp.h
// k-observer-iphone
//
// Created by vvv ооо on 06.09.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#ifndef OBSERVER_CLIENT_CPP_H_INCLUDED
#define OBSERVER_CLIENT_CPP_H_INCLUDED
#include "ClientSocket.h"
void AppDelegateSendOnConnectionClosed();
void AppDelegateSendOnReceiveQuit();
void AppDelegateAddNewMessage(TUserInfo userInfo, std::string message);
void AppDelegateOnAutorizationSend();
class TObserverClient
{
public:
boost::asio::io_service IoService;
boost::thread IoServiceThread;
boost::mutex UpdatingMapMutex;
boost::shared_ptr<TClientSocket> ClientSocket;
boost::shared_ptr<boost::asio::deadline_timer> HeartbeatTimer;
boost::shared_ptr<boost::asio::deadline_timer> MapHeartbeatTimer;
boost::signal<void ()> ReceiveCloseSignal;
std::vector<TUserInfo> UserInfoArr;
std::vector<TUserInfo> AlarmUserInfoArr;
int MapType;
TObserverClient();
void DestroyClientSocket();
void IoServiceRun();
void CreateClientSocket(const char* address, const char* port);
void OnAutorizationSend();
void UpdateUserInfo(const char* lastName,
const char* firstName,
const char* middleName,
const char* phoneNumber,
int uik,
int status);
void RestartHeartbeatTimer();
void RestartMapHeartbeatTimer();
void OnCloseSocket();
void OnReceiveQuit();
void OnHeartbeat(const boost::system::error_code& e);
void OnMapHeartbeat(const boost::system::error_code& e);
void OnReceiveMapUpdate(std::vector<TUserInfo> userInfoArr);
void OnReceiveAlarmMapUpdate(std::vector<TUserInfo> userInfoArr);
void SwitchMapToAlarm();
void SwitchMapToCommon();
bool IsAlarmMap();
void OnReceiveMessage(TUserInfo userInfo, std::string message);
void SendMessage(const char* msg);
};
#endif

View File

@ -0,0 +1,25 @@
//
// ProfileViewControllerViewController.h
// k-observer-iphone
//
// Created by vvv ооо on 26.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ProfileViewController : UIViewController<UIScrollViewDelegate, UITextFieldDelegate>
{
int Status;
}
-(void)finishEditing;
- (BOOL)textFieldShouldReturn:(UITextField *)textField;
- (IBAction)OnUpdateProfilePressed;
- (IBAction)OnObserverSelected;
- (IBAction)OnMobileSelected;
-(void)SwitchAlarmSelector:(BOOL)alarm;
- (IBAction)EditingDidBegin;
@end

View File

@ -0,0 +1,152 @@
//
// ProfileViewControllerViewController.m
// k-observer-iphone
//
// Created by vvv ооо on 26.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "ProfileViewController.h"
#import "AppDelegate.h"
extern AppDelegate* appDelegate;
@interface ProfileViewController ()
@end
@implementation ProfileViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
Status = 0;
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
UIScrollView *tempScrollView=(UIScrollView *)self.view;
tempScrollView.contentSize=CGSizeMake(320, 780);
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
-(void)finishEditing
{
[self.view endEditing:YES];
self.navigationItem.rightBarButtonItem = nil;
}
- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
[self finishEditing];
return YES;
}
- (IBAction)OnUpdateProfilePressed
{
NSString* lastName = ((UITextField*)[self.view viewWithTag:1]).text;
NSString* firstName = ((UITextField*)[self.view viewWithTag:2]).text;
NSString* middleName = ((UITextField*)[self.view viewWithTag:3]).text;
NSString* phoneNumber = ((UITextField*)[self.view viewWithTag:4]).text;
NSString* uikNumberStr = ((UITextField*)[self.view viewWithTag:5]).text;
int uikNumber = [uikNumberStr intValue];
UISegmentedControl* alarlModeControl = (UISegmentedControl*)[self.view viewWithTag:8];
int status = self->Status;
if (status == 0)
{
if ([alarlModeControl selectedSegmentIndex])
{
int mapState = [appDelegate.observerClient GetMapState];
if (mapState < 2)
{
[appDelegate.observerClient SetMapState:2];
}
}
else
{
[appDelegate.observerClient SetMapState:1];
}
}
[appDelegate.observerClient UpdateProfileWithLastName:lastName
FirstName:firstName MiddleName:middleName PhoneNumber:phoneNumber UikNumber:uikNumber Status:status];
}
- (IBAction)OnObserverSelected
{
self->Status = 0;
UILabel* observer_label = (UILabel*)[self.view viewWithTag:6];
UILabel* mobile_label = (UILabel*)[self.view viewWithTag:7];
observer_label.text = @"X";
mobile_label.text = @"";
}
- (IBAction)OnMobileSelected
{
self->Status = 1;
UILabel* observer_label = (UILabel*)[self.view viewWithTag:6];
UILabel* mobile_label = (UILabel*)[self.view viewWithTag:7];
observer_label.text = @"";
mobile_label.text = @"X";
}
-(void)SwitchAlarmSelector:(BOOL)alarm
{
UISegmentedControl* alarmModeControl = (UISegmentedControl*)[self.view viewWithTag:8];
if (alarm)
{
[alarmModeControl setSelectedSegmentIndex:1];
}
else
{
[alarmModeControl setSelectedSegmentIndex:0];
}
}
- (IBAction)EditingDidBegin
{
UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Готово" style:UIBarButtonItemStylePlain target:self action:@selector(finishEditing)];
self.navigationItem.rightBarButtonItem = anotherButton;
}
@end

View File

@ -0,0 +1,863 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1296</int>
<string key="IBDocument.SystemVersion">11E53</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">1181</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBUILabel</string>
<string>IBUIButton</string>
<string>IBUISegmentedControl</string>
<string>IBUIView</string>
<string>IBUITextField</string>
<string>IBProxyObject</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="975951072">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="282577490">
<reference key="NSNextResponder"/>
<int key="NSvFlags">292</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUITextField" id="839109229">
<reference key="NSNextResponder" ref="282577490"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{23, 280}, {273, 31}}</string>
<reference key="NSSuperview" ref="282577490"/>
<reference key="NSNextKeyView" ref="321571368"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUITag">3</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentVerticalAlignment">0</int>
<string key="IBUIText">Anonymous</string>
<int key="IBUIBorderStyle">3</int>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace" id="697038029">
<int key="NSID">2</int>
</object>
</object>
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
<float key="IBUIMinimumFontSize">17</float>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<int key="IBUIReturnKeyType">9</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIFontDescription" key="IBUIFontDescription" id="92022925">
<int key="type">1</int>
<double key="pointSize">14</double>
</object>
<object class="NSFont" key="IBUIFont" id="619593767">
<string key="NSName">Helvetica</string>
<double key="NSSize">14</double>
<int key="NSfFlags">16</int>
</object>
</object>
<object class="IBUILabel" id="46764734">
<reference key="NSNextResponder" ref="282577490"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{16, 20}, {280, 80}}</string>
<reference key="NSSuperview" ref="282577490"/>
<reference key="NSNextKeyView" ref="147487607"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Указанная вами информация будет видна всем и поможет мобильной группе своевременно оказать вам помощь</string>
<object class="NSColor" key="IBUITextColor" id="229077999">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUINumberOfLines">4</int>
<int key="IBUITextAlignment">1</int>
<object class="IBUIFontDescription" key="IBUIFontDescription">
<int key="type">1</int>
<double key="pointSize">15</double>
</object>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica</string>
<double key="NSSize">15</double>
<int key="NSfFlags">16</int>
</object>
</object>
<object class="IBUILabel" id="147487607">
<reference key="NSNextResponder" ref="282577490"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{24, 105}, {78, 21}}</string>
<reference key="NSSuperview" ref="282577490"/>
<reference key="NSNextKeyView" ref="514269227"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Фамилия:</string>
<reference key="IBUITextColor" ref="229077999"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<object class="IBUIFontDescription" key="IBUIFontDescription" id="503462448">
<int key="type">1</int>
<double key="pointSize">17</double>
</object>
<object class="NSFont" key="IBUIFont" id="154511400">
<string key="NSName">Helvetica</string>
<double key="NSSize">17</double>
<int key="NSfFlags">16</int>
</object>
</object>
<object class="IBUITextField" id="514269227">
<reference key="NSNextResponder" ref="282577490"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 134}, {273, 31}}</string>
<reference key="NSSuperview" ref="282577490"/>
<reference key="NSNextKeyView" ref="72923569"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUITag">1</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentVerticalAlignment">0</int>
<string key="IBUIText">Anonymous</string>
<int key="IBUIBorderStyle">3</int>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
<reference key="NSCustomColorSpace" ref="697038029"/>
</object>
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
<float key="IBUIMinimumFontSize">17</float>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<int key="IBUIReturnKeyType">9</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<reference key="IBUIFontDescription" ref="92022925"/>
<reference key="IBUIFont" ref="619593767"/>
</object>
<object class="IBUILabel" id="72923569">
<reference key="NSNextResponder" ref="282577490"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{27, 173}, {78, 21}}</string>
<reference key="NSSuperview" ref="282577490"/>
<reference key="NSNextKeyView" ref="603276169"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Имя:</string>
<reference key="IBUITextColor" ref="229077999"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<reference key="IBUIFontDescription" ref="503462448"/>
<reference key="IBUIFont" ref="154511400"/>
</object>
<object class="IBUITextField" id="603276169">
<reference key="NSNextResponder" ref="282577490"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{24, 202}, {273, 31}}</string>
<reference key="NSSuperview" ref="282577490"/>
<reference key="NSNextKeyView" ref="916615664"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUITag">2</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentVerticalAlignment">0</int>
<string key="IBUIText">Anonymous</string>
<int key="IBUIBorderStyle">3</int>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
<reference key="NSCustomColorSpace" ref="697038029"/>
</object>
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
<float key="IBUIMinimumFontSize">17</float>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<int key="IBUIReturnKeyType">9</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<reference key="IBUIFontDescription" ref="92022925"/>
<reference key="IBUIFont" ref="619593767"/>
</object>
<object class="IBUILabel" id="916615664">
<reference key="NSNextResponder" ref="282577490"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{24, 251}, {81, 21}}</string>
<reference key="NSSuperview" ref="282577490"/>
<reference key="NSNextKeyView" ref="839109229"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Отчество:</string>
<reference key="IBUITextColor" ref="229077999"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<reference key="IBUIFontDescription" ref="503462448"/>
<reference key="IBUIFont" ref="154511400"/>
</object>
<object class="IBUILabel" id="321571368">
<reference key="NSNextResponder" ref="282577490"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{23, 329}, {178, 21}}</string>
<reference key="NSSuperview" ref="282577490"/>
<reference key="NSNextKeyView" ref="770903181"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Контактный телефон:</string>
<reference key="IBUITextColor" ref="229077999"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<reference key="IBUIFontDescription" ref="503462448"/>
<reference key="IBUIFont" ref="154511400"/>
</object>
<object class="IBUITextField" id="770903181">
<reference key="NSNextResponder" ref="282577490"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{22, 354}, {273, 31}}</string>
<reference key="NSSuperview" ref="282577490"/>
<reference key="NSNextKeyView" ref="466704194"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUITag">4</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentVerticalAlignment">0</int>
<string key="IBUIText"/>
<int key="IBUIBorderStyle">3</int>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
<reference key="NSCustomColorSpace" ref="697038029"/>
</object>
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
<float key="IBUIMinimumFontSize">17</float>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<int key="IBUIKeyboardType">6</int>
<int key="IBUIReturnKeyType">9</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<reference key="IBUIFontDescription" ref="92022925"/>
<reference key="IBUIFont" ref="619593767"/>
</object>
<object class="IBUILabel" id="466704194">
<reference key="NSNextResponder" ref="282577490"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{23, 404}, {178, 21}}</string>
<reference key="NSSuperview" ref="282577490"/>
<reference key="NSNextKeyView" ref="195196723"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Номер УИК:</string>
<reference key="IBUITextColor" ref="229077999"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<reference key="IBUIFontDescription" ref="503462448"/>
<reference key="IBUIFont" ref="154511400"/>
</object>
<object class="IBUITextField" id="195196723">
<reference key="NSNextResponder" ref="282577490"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{22, 429}, {273, 31}}</string>
<reference key="NSSuperview" ref="282577490"/>
<reference key="NSNextKeyView" ref="1006847363"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUITag">5</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentVerticalAlignment">0</int>
<string key="IBUIText">0</string>
<int key="IBUIBorderStyle">3</int>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
<reference key="NSCustomColorSpace" ref="697038029"/>
</object>
<bool key="IBUIAdjustsFontSizeToFit">YES</bool>
<float key="IBUIMinimumFontSize">17</float>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<int key="IBUIKeyboardType">4</int>
<int key="IBUIReturnKeyType">9</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<reference key="IBUIFontDescription" ref="92022925"/>
<reference key="IBUIFont" ref="619593767"/>
</object>
<object class="IBUIButton" id="530770646">
<reference key="NSNextResponder" ref="282577490"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{36, 520}, {240, 36}}</string>
<reference key="NSSuperview" ref="282577490"/>
<reference key="NSNextKeyView" ref="236379171"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Вы наблюдатель</string>
<object class="NSColor" key="IBUIHighlightedTitleColor" id="801819571">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<object class="NSColor" key="IBUINormalTitleShadowColor" id="84639720">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC41AA</bytes>
</object>
<object class="NSCustomResource" key="IBUINormalBackgroundImage" id="381236308">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">button.png</string>
</object>
<object class="IBUIFontDescription" key="IBUIFontDescription" id="844213189">
<int key="type">2</int>
<double key="pointSize">15</double>
</object>
<object class="NSFont" key="IBUIFont" id="895703703">
<string key="NSName">Helvetica-Bold</string>
<double key="NSSize">15</double>
<int key="NSfFlags">16</int>
</object>
</object>
<object class="IBUIButton" id="455213058">
<reference key="NSNextResponder" ref="282577490"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{36, 575}, {240, 36}}</string>
<reference key="NSSuperview" ref="282577490"/>
<reference key="NSNextKeyView" ref="90578176"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Вы мобильная группа</string>
<reference key="IBUIHighlightedTitleColor" ref="801819571"/>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="84639720"/>
<reference key="IBUINormalBackgroundImage" ref="381236308"/>
<reference key="IBUIFontDescription" ref="844213189"/>
<reference key="IBUIFont" ref="895703703"/>
</object>
<object class="IBUILabel" id="1006847363">
<reference key="NSNextResponder" ref="282577490"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{48, 491}, {128, 21}}</string>
<reference key="NSSuperview" ref="282577490"/>
<reference key="NSNextKeyView" ref="530770646"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Выберите роль:</string>
<reference key="IBUITextColor" ref="229077999"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<reference key="IBUIFontDescription" ref="503462448"/>
<reference key="IBUIFont" ref="154511400"/>
</object>
<object class="IBUILabel" id="90578176">
<reference key="NSNextResponder" ref="282577490"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{284, 582}, {42, 21}}</string>
<reference key="NSSuperview" ref="282577490"/>
<reference key="NSNextKeyView" ref="552038694"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<int key="IBUITag">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText"/>
<reference key="IBUITextColor" ref="229077999"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<reference key="IBUIFontDescription" ref="503462448"/>
<reference key="IBUIFont" ref="154511400"/>
</object>
<object class="IBUILabel" id="236379171">
<reference key="NSNextResponder" ref="282577490"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{284, 527}, {42, 21}}</string>
<reference key="NSSuperview" ref="282577490"/>
<reference key="NSNextKeyView" ref="455213058"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<int key="IBUITag">6</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">X</string>
<reference key="IBUITextColor" ref="229077999"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<reference key="IBUIFontDescription" ref="503462448"/>
<reference key="IBUIFont" ref="154511400"/>
</object>
<object class="IBUIButton" id="686470672">
<reference key="NSNextResponder" ref="282577490"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{40, 715}, {240, 36}}</string>
<reference key="NSSuperview" ref="282577490"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<int key="IBUIButtonType">1</int>
<string key="IBUINormalTitle">Обновить</string>
<reference key="IBUIHighlightedTitleColor" ref="801819571"/>
<object class="NSColor" key="IBUINormalTitleColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
</object>
<reference key="IBUINormalTitleShadowColor" ref="84639720"/>
<reference key="IBUINormalBackgroundImage" ref="381236308"/>
<reference key="IBUIFontDescription" ref="844213189"/>
<reference key="IBUIFont" ref="895703703"/>
</object>
<object class="IBUISegmentedControl" id="200372069">
<reference key="NSNextResponder" ref="282577490"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{44, 649}, {233, 44}}</string>
<reference key="NSSuperview" ref="282577490"/>
<reference key="NSNextKeyView" ref="686470672"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<int key="IBUITag">8</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBNumberOfSegments">2</int>
<int key="IBSelectedSegmentIndex">0</int>
<array key="IBSegmentTitles">
<string>Выключен</string>
<string>Включен</string>
</array>
<array class="NSMutableArray" key="IBSegmentWidths">
<real value="0.0"/>
<real value="0.0"/>
</array>
<array class="NSMutableArray" key="IBSegmentEnabledStates">
<boolean value="YES"/>
<boolean value="YES"/>
</array>
<array class="NSMutableArray" key="IBSegmentContentOffsets">
<string>{0, 0}</string>
<string>{0, 0}</string>
</array>
<array class="NSMutableArray" key="IBSegmentImages">
<object class="NSNull" id="4"/>
<reference ref="4"/>
</array>
</object>
<object class="IBUILabel" id="552038694">
<reference key="NSNextResponder" ref="282577490"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{53, 620}, {128, 21}}</string>
<reference key="NSSuperview" ref="282577490"/>
<reference key="NSNextKeyView" ref="200372069"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Режим тревоги:</string>
<reference key="IBUITextColor" ref="229077999"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<reference key="IBUIFontDescription" ref="503462448"/>
<reference key="IBUIFont" ref="154511400"/>
</object>
</array>
<string key="NSFrameSize">{320, 771}</string>
<reference key="NSSuperview"/>
<reference key="NSNextKeyView" ref="46764734"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC44NDUzMDkwODU0IDAuOTI2MjM3MDMwNCAxAA</bytes>
</object>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="282577490"/>
</object>
<int key="connectionID">48</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="839109229"/>
<reference key="destination" ref="372490531"/>
</object>
<int key="connectionID">53</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">EditingDidBegin</string>
<reference key="source" ref="839109229"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">17</int>
</object>
<int key="connectionID">68</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="514269227"/>
<reference key="destination" ref="372490531"/>
</object>
<int key="connectionID">51</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">EditingDidBegin</string>
<reference key="source" ref="514269227"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">17</int>
</object>
<int key="connectionID">66</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="603276169"/>
<reference key="destination" ref="372490531"/>
</object>
<int key="connectionID">52</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">EditingDidBegin</string>
<reference key="source" ref="603276169"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">17</int>
</object>
<int key="connectionID">67</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="770903181"/>
<reference key="destination" ref="372490531"/>
</object>
<int key="connectionID">54</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">EditingDidBegin</string>
<reference key="source" ref="770903181"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">17</int>
</object>
<int key="connectionID">65</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="282577490"/>
<reference key="destination" ref="372490531"/>
</object>
<int key="connectionID">49</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">OnObserverSelected</string>
<reference key="source" ref="530770646"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">57</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">OnMobileSelected</string>
<reference key="source" ref="455213058"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">58</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">OnUpdateProfilePressed</string>
<reference key="source" ref="686470672"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">7</int>
</object>
<int key="connectionID">56</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="195196723"/>
<reference key="destination" ref="372490531"/>
</object>
<int key="connectionID">61</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchEventConnection" key="connection">
<string key="label">EditingDidBegin</string>
<reference key="source" ref="195196723"/>
<reference key="destination" ref="372490531"/>
<int key="IBEventType">17</int>
</object>
<int key="connectionID">69</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="975951072"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">21</int>
<reference key="object" ref="282577490"/>
<array class="NSMutableArray" key="children">
<reference ref="46764734"/>
<reference ref="321571368"/>
<reference ref="770903181"/>
<reference ref="839109229"/>
<reference ref="916615664"/>
<reference ref="603276169"/>
<reference ref="72923569"/>
<reference ref="514269227"/>
<reference ref="147487607"/>
<reference ref="466704194"/>
<reference ref="195196723"/>
<reference ref="1006847363"/>
<reference ref="200372069"/>
<reference ref="552038694"/>
<reference ref="455213058"/>
<reference ref="530770646"/>
<reference ref="236379171"/>
<reference ref="90578176"/>
<reference ref="686470672"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">4</int>
<reference key="object" ref="839109229"/>
<reference key="parent" ref="282577490"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="46764734"/>
<reference key="parent" ref="282577490"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">7</int>
<reference key="object" ref="147487607"/>
<reference key="parent" ref="282577490"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">8</int>
<reference key="object" ref="514269227"/>
<reference key="parent" ref="282577490"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">9</int>
<reference key="object" ref="72923569"/>
<reference key="parent" ref="282577490"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">10</int>
<reference key="object" ref="603276169"/>
<reference key="parent" ref="282577490"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">11</int>
<reference key="object" ref="916615664"/>
<reference key="parent" ref="282577490"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">14</int>
<reference key="object" ref="321571368"/>
<reference key="parent" ref="282577490"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">15</int>
<reference key="object" ref="770903181"/>
<reference key="parent" ref="282577490"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">39</int>
<reference key="object" ref="530770646"/>
<reference key="parent" ref="282577490"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">40</int>
<reference key="object" ref="455213058"/>
<reference key="parent" ref="282577490"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">41</int>
<reference key="object" ref="1006847363"/>
<reference key="parent" ref="282577490"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">42</int>
<reference key="object" ref="90578176"/>
<reference key="parent" ref="282577490"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">43</int>
<reference key="object" ref="236379171"/>
<reference key="parent" ref="282577490"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">55</int>
<reference key="object" ref="686470672"/>
<reference key="parent" ref="282577490"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">59</int>
<reference key="object" ref="466704194"/>
<reference key="parent" ref="282577490"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">60</int>
<reference key="object" ref="195196723"/>
<reference key="parent" ref="282577490"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">63</int>
<reference key="object" ref="200372069"/>
<reference key="parent" ref="282577490"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">64</int>
<reference key="object" ref="552038694"/>
<reference key="parent" ref="282577490"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.CustomClassName">ProfileViewController</string>
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="10.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="11.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="14.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="15.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="21.CustomClassName">UIScrollView</string>
<string key="21.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="39.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="40.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="41.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="42.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="43.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="55.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="59.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="60.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="63.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="64.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="7.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="9.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">69</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<real value="1296" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<string key="NS.key.0">button.png</string>
<string key="NS.object.0">{480, 72}</string>
</object>
<string key="IBCocoaTouchPluginVersion">1181</string>
</data>
</archive>

View File

@ -0,0 +1,13 @@
//
// SendMessageViewController.h
// k-observer-iphone
//
// Created by vvv ооо on 31.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SendMessageViewController : UIViewController
@end

View File

@ -0,0 +1,79 @@
//
// SendMessageViewController.m
// k-observer-iphone
//
// Created by vvv ооо on 31.08.12.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#import "SendMessageViewController.h"
#import "AppDelegate.h"
extern AppDelegate* appDelegate;
@interface SendMessageViewController ()
@end
@implementation SendMessageViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
-(void)viewDidAppear:(BOOL)animated
{
UIBarButtonItem *anotherButton = [[UIBarButtonItem alloc] initWithTitle:@"Отправить" style:UIBarButtonItemStylePlain target:self action:@selector(SendMessage)];
self.navigationItem.rightBarButtonItem = anotherButton;
}
-(void)viewDidDisappear:(BOOL)animated
{
self.navigationItem.rightBarButtonItem = nil;
}
-(void)SendMessage
{
self.navigationItem.rightBarButtonItem = nil;
[appDelegate.navController popViewControllerAnimated:true];
NSString* ns_msg = ((UITextView*)[self.view viewWithTag:1]).text;
if (![ns_msg isEqualToString:@""])
{
[appDelegate.observerClient SendMessage:ns_msg];
[((UITextView*)[self.view viewWithTag:1]) setText:@""];
}
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end

View File

@ -0,0 +1,214 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1296</int>
<string key="IBDocument.SystemVersion">11E53</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">1181</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBUITextView</string>
<string>IBUIImageView</string>
<string>IBUIView</string>
<string>IBUILabel</string>
<string>IBProxyObject</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="975951072">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="191373211">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUIImageView" id="153195429">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{0, 40}, {320, 186}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSNextKeyView" ref="169379882"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSCustomResource" key="IBUIImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">messages_text.png</string>
</object>
</object>
<object class="IBUITextView" id="169379882">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">274</int>
<string key="NSFrame">{{0, 40}, {320, 186}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC44Njk1NjUyMTc0IDAuODY5NTY1MjE3NCAwLjg2OTU2NTIxNzQgMAA</bytes>
</object>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
<int key="IBUITag">1</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText"/>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<int key="IBUIAutocapitalizationType">2</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIFontDescription" key="IBUIFontDescription">
<int key="type">1</int>
<double key="pointSize">14</double>
</object>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica</string>
<double key="NSSize">14</double>
<int key="NSfFlags">16</int>
</object>
</object>
<object class="IBUILabel" id="841799661">
<reference key="NSNextResponder" ref="191373211"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{20, 12}, {280, 21}}</string>
<reference key="NSSuperview" ref="191373211"/>
<reference key="NSNextKeyView" ref="153195429"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Введите сообщение для отправки:</string>
<object class="NSColor" key="IBUITextColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<object class="IBUIFontDescription" key="IBUIFontDescription">
<int key="type">1</int>
<double key="pointSize">17</double>
</object>
<object class="NSFont" key="IBUIFont">
<string key="NSName">Helvetica</string>
<double key="NSSize">17</double>
<int key="NSfFlags">16</int>
</object>
</object>
</array>
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
<reference key="NSSuperview"/>
<reference key="NSNextKeyView" ref="841799661"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MC44NDUzMDkwODU0IDAuOTI2MjM3MDMwNCAxAA</bytes>
</object>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="191373211"/>
</object>
<int key="connectionID">3</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="191373211"/>
<array class="NSMutableArray" key="children">
<reference ref="153195429"/>
<reference ref="841799661"/>
<reference ref="169379882"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="975951072"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">4</int>
<reference key="object" ref="169379882"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">5</int>
<reference key="object" ref="153195429"/>
<reference key="parent" ref="191373211"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="841799661"/>
<reference key="parent" ref="191373211"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.CustomClassName">SendMessageViewController</string>
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="4.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="5.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">6</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes"/>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<real value="1296" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<string key="NS.key.0">messages_text.png</string>
<string key="NS.object.0">{640, 372}</string>
</object>
<string key="IBCocoaTouchPluginVersion">1181</string>
</data>
</archive>

Some files were not shown because too many files have changed in this diff Show More