initi.doc/docfiles/providers/managers/models/model.js

177 lines
4.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* ### Модель (устройство, девайс).
*
* Представляет интефрейс для доступа к данным устройства.
*
* Позволяет получить список компонентов модели
*
* <br>
* Связанные объекты:
*
* - {@link Models Models} - Менеджер моделей.
* - {@link Models.Model.Groups Groups} - Группы моделей (список компонентов, которые есть у модели).
* - {@link Models.Model.static static} - Статические данные модели
*
* @class Model
* @memberof Models
*/
function Model() {
/**
*
* @public
* @name static
* @type {Models.Model.static_data}
*/
this.static = new Models.Model.static_data();
/**
*
* @public
* @function address
* @memberof Models.Model
* @returns {v2.address}
*/
this.address = function() {
};
/**
*
* @public
* @function groups
* @memberof Models.Model
* @returns {tools.promise}
*/
this.groups = function() {
};
/**
*
* @public
* @function get_group
* @memberof Models.Model
* @param groupType {v2.model_type}
* @returns {tools.promise(ModelGroup)}
*/
this.get_group = function(groupType) {
};
/**
* #### Загрузка статических переменных для устройства
*
* @example
* // Пример, как получить доступ к статическим переменным устройства.
*
* // Создадим промис для отслеживания результата
* var pr = new tools.promise();
*
* var model_provider = null;
* var model_ref = null;
*
* // запрос по адресу модели в менеджер моделей
* ps.pl.mm().get(_model_addr).then(function (_ref) {
* model_ref = _ref;
* model_provider = _ref.value();
*
* // запрос на получение статических данных
* 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));
*
* // После того как будет получен полный результат, необходимо сбросить ссылку
* var clear = function () {
* model_ref.reset();
* model_ref = null;
* model_provider = null;
* };
*
*
* @public
* @function touch
* @memberof Models.Model
* @returns {tools.promise}
*/
this.touch = function() {
};
/**
*
* @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) {
};
/**
*
* @public
* @function debug
* @memberof Models.Model
* @param {v2.address} destination
* @param {v2.address} variables
*/
this.debug = function(destination, variables) {
};
}