classdef helperBluetoothBaseNode < handle
%helperBluetoothBaseNode Create a base object for Bluetooth node
%   BTBASENODE = helperBluetoothBaseNode creates a base object for
%   Bluetooth node.
%
%   BTBASENODE = helperBluetoothBaseNode(Name, Value) creates a base object
%   for Bluetooth node with the specified property Name set to the
%   specified Value. You can specify additional name-value pair arguments
%   in any order as (Name1, Value1, ..., NameN, ValueN).
%
%   helperBluetoothBaseNode properties:
%
%   NodePosition        - Node position in cartesian coordinates [x y z]
%   NodeID              - Node identifier

%   Copyright 2020 The MathWorks, Inc.

properties
    %NodePosition Node position in cartesian coordinates [x y z]
    %   Specify node position as a row-vector of integer values
    %   representing the three-dimensional coordinate [x y z]. It defines
    %   the position of the node in a specified area. Currently, 'z' value
    %   is not considered. The default value is [0 0 0].
    NodePosition = [0 0 0]
    
    %NodeID Node identifier
    %   Specify node identifier as a positive integer value representing
    %   the node. It is the unique identifier for the nodes within the
    %   network. The default value is 1.
    NodeID = 1
end

methods
    % Constructor
    function obj = helperBluetoothNode(varargin)
        % Name-value pairs
        for idx = 1:2:nargin
            obj.(varargin{idx}) = varargin{idx+1};
        end
    end
    
    % Set node position
    function set.NodePosition(obj, value)
        validateattributes(value, {'numeric'}, {'row', 'numel', 3}, ...
            mfilename, 'NodePosition');
        obj.NodePosition = value;
    end
    
    % Set node identifier
    function set.NodeID(obj, value)
        validateattributes(value, {'numeric'}, {'scalar', 'positive', ...
            'integer'}, mfilename, 'NodeID');
        obj.NodeID = value;
    end
end
end
