55 Commits

Author SHA1 Message Date
Wataru Ishida
a6b842762d framework: remove unnecessary dynamic link to the meta library
meta library is statically linked

Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2022-02-18 10:32:24 +09:00
Wataru Ishida
077ba2727d framework: let user decide the optimization level
Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2022-02-18 10:32:24 +09:00
Wataru Ishida
e1af71517a framework: fix list of sources and headers
include meta library sources to the library to support meta API
with custom attributes

Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2022-02-17 12:14:19 +09:00
Wataru Ishida
d474c52d9d framework: include meta library object code to support meta APIs
Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2022-02-16 17:50:35 +09:00
Wataru Ishida
fc632a42f7 improve build
Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2022-02-14 14:24:45 +09:00
Wataru Ishida
b1707a9905 improve build
Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2022-02-12 23:43:18 +09:00
Wataru Ishida
e3e3a0fc4c use -Wall -Werror for build
Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2022-02-12 23:43:18 +09:00
Wataru Ishida
9e1a9f6555 framework: don't call notification callback when attrs.size() == 0
Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2022-02-10 19:59:16 +09:00
Wataru Ishida
7a0671ec40 framework: don't queue the next state if already exists
Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2022-01-23 20:59:20 +09:00
Wataru Ishida
7246caa3d1 meta: support deserializing empty list
Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2022-01-19 18:46:43 +09:00
Wataru Ishida
462b6971a1 framework: fix next-state overwriting
Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2021-12-01 22:12:13 +09:00
Wataru Ishida
9e0effa95e meta: support adding custom enum values to TAI attributes
Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2021-09-13 16:19:46 +09:00
Wataru Ishida
ed79f0ccac framework/examples/basic: show how to add capability support
Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2021-08-11 00:50:40 +09:00
Wataru Ishida
96fe7cc006 framework: initial support of capability API
Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2021-08-11 00:50:40 +09:00
Wataru Ishida
7c83724333 framework: return immediately when attr_count is 0
suppress misleading debug messages

Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2021-08-11 00:50:40 +09:00
Wataru Ishida
4d51cd3395 framework: remove unused function
Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2021-08-11 00:50:40 +09:00
Wataru Ishida
13c18a9bd6 framework/example/basic: suppress complile warning
Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2021-08-11 00:50:40 +09:00
Wataru Ishida
06e7774ff3 framework: make the destructor of Platform virtual
Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2021-07-28 12:07:54 +09:00
Wataru Ishida
22e3bcd123 framework: add direct_set/get for default_setter/getter
Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2021-04-26 15:44:28 +09:00
Wataru Ishida
7595139b74 add meta APIs to TAI
Unlike SAI, TAI needs to handle different kinds of devices
simultaneously. In order to support this, we have tai-mux library
which multiplexes multiple TAI libraries and provide a single TAI interface
to upper application.

However, there was no multiplex or aggregation layer for TAI *metadata*.
TAI metadata is used to know each TAI attributes characteristic and provides
utility functionality like string serialization.

Because of this lack of multiplex layer, application developers have to
create a TAI meta library by manually aggregating all TAI attributes of
TAI libraries which are planned to be used.

This is tedious, error prone works and makes it difficult to support
new TAI library dynamically.

In order to solve this issue, this commits adds meta APIs to TAI APIs.
By doing so, TAI *metadata* can be multiplexed by tai-mux just like
other APIs.

This commit also enhances TAI library framework to automatically support
the new meta APIs.

TAI library which is based on the framework will get the meta API
functionally automatically by recompiling it.

Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2021-04-26 15:44:28 +09:00
Wataru Ishida
3bb6195337 framework: support customizing transit condition
also fix typo

Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2021-02-15 12:58:04 -08:00
Wataru Ishida
0c8d4ddce5 framework: support getting a user specified attribute
Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2021-01-25 12:47:01 -08:00
Wataru Ishida
0a483c5c95 tools/framework: use set_attribites in Config constructor
Since _set() doesn't call the default setter, if the object is
created with attributes which uses the default setter, the object
creation was failing.

Fixed the issue by modifying set_attributes() to accept readonly flag
and use it in the Config constructor.

Signed-off-by: Wataru Ishida <wataru.ishid@gmail.com>
2020-09-11 15:57:23 -07:00
Wataru Ishida
cb6e69eaa0 framework: don't call a set_hook when caching attributes for alarm
m_alarm_cache is used to *compare* an attribute which is already sent
and an attribute which is going to be sent.

We don't neet to call a set_hook for this purpose

Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-15 10:55:11 -08:00
Wataru Ishida
eaafeb7ce5 lib: add TAI_ prefix to MACROs
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-14 15:10:13 -08:00
Wataru Ishida
d07a6ffb97 framework: update m_next_state before entering s_cb
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-14 15:10:13 -08:00
Wataru Ishida
ceb38227e7 framework: copy attribute even if getter() failed
when the attribute passed from user doesn't have enough space,
getter() return BUFFER_OVERFLOW err code and update the count field.
so we need to copy the attribute

Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-13 17:32:41 -08:00
Wataru Ishida
4ce1993058 framework: don't fallback to default getter when per-attribute getter exists
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-13 17:32:41 -08:00
Wataru Ishida
c02f0c9b5c framework: fix bug of per-attribute getter() handling
when getter() callback is registered, don't try getting the attribute
from the internal map through _get(attr->id)

also in case of buffer overflow error, don't fallback to default_getter.

Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-09 10:04:24 -08:00
Wataru Ishida
e26ccf5ba2 framework: fix default setter/getter to accept multiple attributes at once
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-08 16:34:43 -08:00
Wataru Ishida
5f313d5bc9 framework: catch exception when creating notification contents
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-08 16:34:43 -08:00
Wataru Ishida
1b4a6273c4 framework/lib: curve out common helper class under lib/
also change framework namespace to ::tai::framework from ::tai

Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-06 10:56:59 -08:00
Wataru Ishida
66b4b947b8 framework: enhance Attribute class
this will be used in taish server code

Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-06 10:56:59 -08:00
Wataru Ishida
fe95cbe409 framework: fix compiler warning
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-06 10:56:59 -08:00
Wataru Ishida
40a4451e15 framework: return immediately after calling getter if exists
don't fallback to default getter which can overwrites err code

Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-06 10:56:59 -08:00
Wataru Ishida
3fbf9d3129 framework: add S_ConstAttribute typedef
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-04 11:11:19 -08:00
Wataru Ishida
ed73aa8f64 framework/basic: fix bug of FSM initialization
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-04 11:11:19 -08:00
Wataru Ishida
891710db3d framework/basic: support getting tributary mapping
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-04 11:11:19 -08:00
Wataru Ishida
c3220b552c framework: make Object::id()/type() const method
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-04 11:11:19 -08:00
Wataru Ishida
ef47381fd0 framework/basic: support removing objects
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-03 17:31:56 -08:00
Wataru Ishida
266458dfeb framework: add a hook for logging setting
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-03 17:31:56 -08:00
Wataru Ishida
ea862f53ec framework: make host/network interface api callback struct static
these struct should be retrieved by tai_api_query() and better not to
expose

Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-03 09:06:15 -08:00
Wataru Ishida
9782db1b80 basic: use default setter/getter
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-03 09:06:15 -08:00
Wataru Ishida
8accb7ce32 framework: support default setter/getter callback in config
default setter/getter can be set as a fallback callback

Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-03 09:06:15 -08:00
Wataru Ishida
1138c91443 framework: add Exception class
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-03 09:06:15 -08:00
Wataru Ishida
5dcfe539ed framework: add ::tai::Logger namespace for LOG macro
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-03 09:06:15 -08:00
Wataru Ishida
9113aa61c5 framework: add fsm() accessor
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-03 09:06:15 -08:00
Wataru Ishida
00f57b5fda framework: use __PRETTY_FUNCTION__ for function name macro
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-03 09:06:15 -08:00
Wataru Ishida
10539ef986 framework: add prev_state() accessor
Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-03 09:06:15 -08:00
Wataru Ishida
dfcc1697ba framework: compare with default value
the previous behavior only do comparison when the value is set by a
user and the value was pushed to diff array even if it is equal to the
default value.

this commit fix the behavior by using Config::_get() which returns a
default value when the value is not set by a user.

Signed-off-by: Wataru Ishida <ishida@nel-america.com>
2020-01-03 09:06:15 -08:00