2018-09-19 10:25:01 +00:00
|
|
|
|
/**
|
2019-03-18 13:14:33 +00:00
|
|
|
|
* ### Модель (устройство, девайс).
|
2018-12-19 10:08:57 +00:00
|
|
|
|
*
|
2018-09-24 16:03:29 +00:00
|
|
|
|
* Представляет интефрейс для доступа к данным устройства.
|
2018-12-19 10:08:57 +00:00
|
|
|
|
*
|
2018-09-24 16:03:29 +00:00
|
|
|
|
* Позволяет получить список компонентов модели
|
2018-09-19 10:25:01 +00:00
|
|
|
|
*
|
2019-03-18 13:14:33 +00:00
|
|
|
|
* <br>
|
|
|
|
|
* Связанные объекты:
|
|
|
|
|
*
|
|
|
|
|
* - {@link Models Models} - Менеджер моделей.
|
|
|
|
|
* - {@link Models.Model.Groups Groups} - Группы моделей (список компонентов, которые есть у модели).
|
|
|
|
|
* - {@link Models.Model.static static} - Статические данные модели
|
2018-12-19 10:08:57 +00:00
|
|
|
|
*
|
2018-09-19 10:25:01 +00:00
|
|
|
|
* @class Model
|
|
|
|
|
* @memberof Models
|
|
|
|
|
*/
|
|
|
|
|
function Model() {
|
2018-09-25 12:14:18 +00:00
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @public
|
|
|
|
|
* @name static
|
|
|
|
|
* @type {Models.Model.static_data}
|
|
|
|
|
*/
|
|
|
|
|
this.static = new Models.Model.static_data();
|
|
|
|
|
|
|
|
|
|
|
2018-09-19 10:25:01 +00:00
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @public
|
|
|
|
|
* @function address
|
|
|
|
|
* @memberof Models.Model
|
2018-09-19 10:40:04 +00:00
|
|
|
|
* @returns {v2.address}
|
2018-09-19 10:25:01 +00:00
|
|
|
|
*/
|
|
|
|
|
this.address = function() {
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @public
|
|
|
|
|
* @function groups
|
|
|
|
|
* @memberof Models.Model
|
2018-09-19 10:40:04 +00:00
|
|
|
|
* @returns {tools.promise}
|
2018-09-19 10:25:01 +00:00
|
|
|
|
*/
|
|
|
|
|
this.groups = function() {
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
2018-09-25 12:14:18 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @public
|
|
|
|
|
* @function get_group
|
|
|
|
|
* @memberof Models.Model
|
|
|
|
|
* @param groupType {v2.model_type}
|
|
|
|
|
* @returns {tools.promise(ModelGroup)}
|
|
|
|
|
*/
|
|
|
|
|
this.get_group = function(groupType) {
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
2018-09-19 10:25:01 +00:00
|
|
|
|
/**
|
2018-12-19 10:13:24 +00:00
|
|
|
|
* #### Загрузка статических переменных для устройства
|
2018-12-19 10:08:57 +00:00
|
|
|
|
*
|
|
|
|
|
* @example
|
2018-12-19 10:13:24 +00:00
|
|
|
|
* // Пример, как получить доступ к статическим переменным устройства.
|
|
|
|
|
*
|
|
|
|
|
* // Создадим промис для отслеживания результата
|
|
|
|
|
* var pr = new tools.promise();
|
|
|
|
|
*
|
2018-12-19 10:08:57 +00:00
|
|
|
|
* var model_provider = null;
|
|
|
|
|
* var model_ref = null;
|
2018-12-19 10:13:24 +00:00
|
|
|
|
*
|
|
|
|
|
* // запрос по адресу модели в менеджер моделей
|
2018-12-19 10:08:57 +00:00
|
|
|
|
* ps.pl.mm().get(_model_addr).then(function (_ref) {
|
|
|
|
|
* model_ref = _ref;
|
|
|
|
|
* model_provider = _ref.value();
|
|
|
|
|
*
|
2018-12-19 10:13:24 +00:00
|
|
|
|
* // запрос на получение статических данных
|
2018-12-19 10:08:57 +00:00
|
|
|
|
* return model_provider.touch();
|
|
|
|
|
* }.bind(this), function (_err) {
|
|
|
|
|
* pr.reject({err: 0, sub: _err, message: "error on get model", model_addr: _model_addr});
|
|
|
|
|
* }.bind(this)).then(function () {
|
|
|
|
|
* pr.resolve({
|
|
|
|
|
* is_container: model_provider.static.is_container(),
|
|
|
|
|
* componentType: model_provider.static.base_component_type()
|
|
|
|
|
* });
|
|
|
|
|
* clear();
|
|
|
|
|
* }.bind(this), function (_err) {
|
|
|
|
|
* clear();
|
|
|
|
|
* pr.reject({err: 0, sub: _err, message: "error on get static model data", model_addr: _model_addr});
|
|
|
|
|
* }.bind(this));
|
|
|
|
|
*
|
2018-12-19 10:13:24 +00:00
|
|
|
|
* // После того как будет получен полный результат, необходимо сбросить ссылку
|
2018-12-19 10:08:57 +00:00
|
|
|
|
* var clear = function () {
|
|
|
|
|
* model_ref.reset();
|
|
|
|
|
* model_ref = null;
|
|
|
|
|
* model_provider = null;
|
|
|
|
|
* };
|
|
|
|
|
*
|
2018-09-19 10:25:01 +00:00
|
|
|
|
*
|
|
|
|
|
* @public
|
|
|
|
|
* @function touch
|
|
|
|
|
* @memberof Models.Model
|
2018-09-19 10:40:04 +00:00
|
|
|
|
* @returns {tools.promise}
|
2018-09-19 10:25:01 +00:00
|
|
|
|
*/
|
|
|
|
|
this.touch = function() {
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
2019-03-19 11:36:08 +00:00
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @public
|
|
|
|
|
* @function get_base_components
|
|
|
|
|
* @memberof Models.Model
|
|
|
|
|
* @param groupType {v2.model_type}
|
|
|
|
|
* @returns {tools.promise()}
|
|
|
|
|
*/
|
|
|
|
|
this.get_base_components = function () {
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @public
|
|
|
|
|
* @function get_components
|
|
|
|
|
* @memberof Models.Model
|
|
|
|
|
* @param {v2.string} _c_tag
|
|
|
|
|
* @param {v2.list<v2.string>} _parent_c_tags
|
|
|
|
|
* @returns {tools.promise()}
|
|
|
|
|
*/
|
|
|
|
|
this.get_components = function (_c_tag, _parent_c_tags) {
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @public
|
|
|
|
|
* @function get_components_with_id
|
|
|
|
|
* @memberof Models.Model
|
|
|
|
|
* @param {v2.string} _c_tag
|
|
|
|
|
* @param {v2.list<v2.string>} _parent_c_tags
|
|
|
|
|
* @param {v2.string} _id
|
|
|
|
|
* @returns {tools.promise()}
|
|
|
|
|
*/
|
|
|
|
|
this.get_components_with_id = function (_c_tag, _parent_c_tags, _id) {
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @public
|
|
|
|
|
* @function get_components_with_parent_id
|
|
|
|
|
* @memberof Models.Model
|
|
|
|
|
* @param {v2.string} _c_tag
|
|
|
|
|
* @param {v2.list<v2.string>} _parent_c_tags
|
|
|
|
|
* @param {v2.string} _parent_id
|
|
|
|
|
* @returns {tools.promise()}
|
|
|
|
|
*/
|
|
|
|
|
this.get_components_with_parent_id = function (_c_tag, _parent_c_tags, _parent_id) {
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2018-09-19 10:25:01 +00:00
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
* @public
|
|
|
|
|
* @function debug
|
|
|
|
|
* @memberof Models.Model
|
2018-09-19 10:40:04 +00:00
|
|
|
|
* @param {v2.address} destination
|
|
|
|
|
* @param {v2.address} variables
|
2018-09-19 10:25:01 +00:00
|
|
|
|
*/
|
|
|
|
|
this.debug = function(destination, variables) {
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
}
|