2021-05-27 10:59:22 -04:00
|
|
|
/*
|
|
|
|
component.h
|
|
|
|
|
|
|
|
Copyright (c) 2021 Kevin Matz (kevin.matz@gmail.com)
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
|
|
copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
SOFTWARE.
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "../uuid/uuid.h"
|
2021-06-19 20:27:11 -04:00
|
|
|
#include <string>
|
2021-05-27 10:59:22 -04:00
|
|
|
|
|
|
|
namespace ACN {
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
/**
|
2021-07-30 09:26:21 -04:00
|
|
|
* @brief The Component class
|
|
|
|
* The process, program or application corresponding to a single ACN endpoint.
|
|
|
|
* All messages in ACN are sent and received by a component.
|
|
|
|
*
|
|
|
|
* See [Arch] for a more complete definition.
|
2021-07-30 09:11:32 -04:00
|
|
|
*/
|
2021-05-27 10:59:22 -04:00
|
|
|
class Component {
|
|
|
|
public:
|
2021-06-19 20:27:11 -04:00
|
|
|
Component(UUID::uuid cid = UUID::uuid())
|
2021-08-02 10:10:55 -04:00
|
|
|
: fctn_(std::string("libESTA ACN Component"))
|
|
|
|
, uacn_(std::string())
|
|
|
|
, cid_(cid)
|
2021-06-19 20:27:11 -04:00
|
|
|
{};
|
2021-05-27 10:59:22 -04:00
|
|
|
|
2021-06-19 20:27:11 -04:00
|
|
|
const UUID::uuid cid() const { return cid_; }
|
|
|
|
const std::string fixedName() const { return fctn_; }
|
|
|
|
const std::string userName() const { return uacn_; }
|
|
|
|
const std::string name() const { return uacn_.empty() ? fctn_ : uacn_; }
|
|
|
|
|
|
|
|
void assignUserName(const std::string s) { uacn_ = s; }
|
2021-05-27 10:59:22 -04:00
|
|
|
|
2021-07-30 09:31:16 -04:00
|
|
|
protected:
|
|
|
|
// EPI 19: ACN Discovery on IP Networks
|
|
|
|
// 3. Component Name Strings
|
|
|
|
// Each component shall maintain two text identifier strings intended to
|
|
|
|
// indicate the function of the component in human readable terms for browsing
|
|
|
|
// purposes.
|
2021-06-19 20:27:11 -04:00
|
|
|
|
2021-07-30 09:31:16 -04:00
|
|
|
/**
|
|
|
|
* @brief 3.1. Fixed Component Type Name (FCTN)
|
|
|
|
* shall be a UTF-8 string that is assigned during manufacture.
|
|
|
|
*/
|
|
|
|
std::string fctn_;
|
2021-06-19 20:27:11 -04:00
|
|
|
|
2021-07-30 09:31:16 -04:00
|
|
|
/**
|
|
|
|
* @brief 3.2. User Assigned Component Name (UACN)
|
|
|
|
* shall be a UTF-8 string that may be assigned by the user.
|
|
|
|
*/
|
|
|
|
std::string uacn_;
|
2021-06-19 20:27:11 -04:00
|
|
|
|
2021-07-30 09:31:16 -04:00
|
|
|
private:
|
|
|
|
const UUID::uuid cid_;
|
2021-05-27 10:59:22 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
}; // ACN
|