Skip to content

Commit

Permalink
Merge pull request #399 from na-trium-144/v2.1_release
Browse files Browse the repository at this point in the history
v2.1 release
  • Loading branch information
na-trium-144 authored Sep 4, 2024
2 parents a603dab + 67d328d commit 6de51c2
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 51 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## [2.1.0] - 2024-09-04
### Added
* LogEntryメッセージ (#397)
* 各種Field型::exists() 追加
* Log::keepLines() 追加 (#398)
* 指定した行数以上のログをClientが保持しないようにした

## [2.0.5] - 2024-09-03
### Changed
* Doxygenでドキュメントを生成するときnamespaceを`webcface`に固定
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.5)

project(webcface VERSION 2.0.5)
project(webcface VERSION 2.1.0)

if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(IS_MAIN on)
Expand Down
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ PROJECT_NAME = "WebCFace"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = "2.0.5"
PROJECT_NUMBER = "2.1.0"

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ Ubuntu20.04でビルドしているため、それより古いUbuntuでは動作
<details open><summary>x86_64</summary>

```sh
curl -fLO https://github.com/na-trium-144/webcface-package/releases/download/v2.0.5/webcface_2.0.5_linux_amd64.zip
sudo unzip webcface_2.0.5_linux_amd64.zip -d /opt/webcface
rm webcface_2.0.5_linux_amd64.zip
curl -fLO https://github.com/na-trium-144/webcface-package/releases/download/v2.1.0/webcface_2.1.0_linux_amd64.zip
sudo unzip webcface_2.1.0_linux_amd64.zip -d /opt/webcface
rm webcface_2.1.0_linux_amd64.zip
echo 'export PATH="/opt/webcface/bin:$PATH"' >> ~/.bashrc
echo 'export PKG_CONFIG_PATH="/opt/webcface/lib/x86_64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH"' >> ~/.bashrc
sudo ln -sf /opt/webcface/lib/systemd/system/*.service /etc/systemd/system/
Expand All @@ -186,9 +186,9 @@ sudo ln -sf /opt/webcface/lib/systemd/system/*.service /etc/systemd/system/
<details><summary>arm64</summary>

```sh
curl -fLO https://github.com/na-trium-144/webcface-package/releases/download/v2.0.5/webcface_2.0.5_linux_arm64.zip
sudo unzip webcface_2.0.5_linux_arm64.zip -d /opt/webcface
rm webcface_2.0.5_linux_arm64.zip
curl -fLO https://github.com/na-trium-144/webcface-package/releases/download/v2.1.0/webcface_2.1.0_linux_arm64.zip
sudo unzip webcface_2.1.0_linux_arm64.zip -d /opt/webcface
rm webcface_2.1.0_linux_arm64.zip
echo 'export PATH="/opt/webcface/bin:$PATH"' >> ~/.bashrc
echo 'export PKG_CONFIG_PATH="/opt/webcface/lib/aarch64-linux-gnu/pkgconfig:$PKG_CONFIG_PATH"' >> ~/.bashrc
sudo ln -sf /opt/webcface/lib/systemd/system/*.service /etc/systemd/system/
Expand All @@ -198,9 +198,9 @@ sudo ln -sf /opt/webcface/lib/systemd/system/*.service /etc/systemd/system/
<details><summary>armhf</summary>

```sh
curl -fLO https://github.com/na-trium-144/webcface-package/releases/download/v2.0.5/webcface_2.0.5_linux_armhf.zip
sudo unzip webcface_2.0.5_linux_armhf.zip -d /opt/webcface
rm webcface_2.0.5_linux_armhf.zip
curl -fLO https://github.com/na-trium-144/webcface-package/releases/download/v2.1.0/webcface_2.1.0_linux_armhf.zip
sudo unzip webcface_2.1.0_linux_armhf.zip -d /opt/webcface
rm webcface_2.1.0_linux_armhf.zip
echo 'export PATH="/opt/webcface/bin:$PATH"' >> ~/.bashrc
echo 'export PKG_CONFIG_PATH="/opt/webcface/lib/arm-linux-gnueabihf/pkgconfig:$PKG_CONFIG_PATH"' >> ~/.bashrc
sudo ln -sf /opt/webcface/lib/systemd/system/*.service /etc/systemd/system/
Expand All @@ -221,10 +221,10 @@ Ubuntu20.04でビルドしているため、それより古いUbuntuでは動作
<details open><summary>x86_64</summary>

```sh
curl -fLO https://github.com/na-trium-144/webcface/releases/download/v2.0.5/webcface_2.0.5_amd64.deb
curl -fLO https://github.com/na-trium-144/webcface/releases/download/v2.1.0/webcface_2.1.0_amd64.deb
curl -fLO https://github.com/na-trium-144/webcface-tools/releases/download/v2.0.1/webcface-tools_2.0.1_amd64.deb
curl -fLO https://github.com/na-trium-144/webcface-webui/releases/download/v1.8.0/webcface-webui_1.8.0_all.deb
curl -fLO https://github.com/na-trium-144/webcface-webui/releases/download/v1.8.0/webcface-desktop_1.8.0_linux_amd64.deb
curl -fLO https://github.com/na-trium-144/webcface-webui/releases/download/v1.8.1/webcface-webui_1.8.1_all.deb
curl -fLO https://github.com/na-trium-144/webcface-webui/releases/download/v1.8.1/webcface-desktop_1.8.1_linux_amd64.deb
sudo apt install ./webcface*.deb
rm ./webcface*.deb
```
Expand All @@ -233,10 +233,10 @@ rm ./webcface*.deb
<details><summary>arm64</summary>

```sh
curl -fLO https://github.com/na-trium-144/webcface/releases/download/v2.0.5/webcface_2.0.5_arm64.deb
curl -fLO https://github.com/na-trium-144/webcface/releases/download/v2.1.0/webcface_2.1.0_arm64.deb
curl -fLO https://github.com/na-trium-144/webcface-tools/releases/download/v2.0.1/webcface-tools_2.0.1_arm64.deb
curl -fLO https://github.com/na-trium-144/webcface-webui/releases/download/v1.8.0/webcface-webui_1.8.0_all.deb
curl -fLO https://github.com/na-trium-144/webcface-webui/releases/download/v1.8.0/webcface-desktop_1.8.0_linux_arm64.deb
curl -fLO https://github.com/na-trium-144/webcface-webui/releases/download/v1.8.1/webcface-webui_1.8.1_all.deb
curl -fLO https://github.com/na-trium-144/webcface-webui/releases/download/v1.8.1/webcface-desktop_1.8.1_linux_arm64.deb
sudo apt install ./webcface*.deb
rm ./webcface*.deb
```
Expand All @@ -245,10 +245,10 @@ rm ./webcface*.deb
<details><summary>armhf</summary>

```sh
curl -fLO https://github.com/na-trium-144/webcface/releases/download/v2.0.5/webcface_2.0.5_armhf.deb
curl -fLO https://github.com/na-trium-144/webcface/releases/download/v2.1.0/webcface_2.1.0_armhf.deb
curl -fLO https://github.com/na-trium-144/webcface-tools/releases/download/v2.0.1/webcface-tools_2.0.1_armhf.deb
curl -fLO https://github.com/na-trium-144/webcface-webui/releases/download/v1.8.0/webcface-webui_1.8.0_all.deb
curl -fLO https://github.com/na-trium-144/webcface-webui/releases/download/v1.8.0/webcface-desktop_1.8.0_linux_armv7l.deb
curl -fLO https://github.com/na-trium-144/webcface-webui/releases/download/v1.8.1/webcface-webui_1.8.1_all.deb
curl -fLO https://github.com/na-trium-144/webcface-webui/releases/download/v1.8.1/webcface-desktop_1.8.1_linux_armv7l.deb
sudo apt install ./webcface*.deb
rm ./webcface*.deb
```
Expand All @@ -267,16 +267,16 @@ Universalバイナリになっており、IntelMacもAppleシリコンも共通
macOS 12 (Monterey) でビルドしているので、それより古いMacでは動かないかもしれません。

```sh
curl -fLO https://github.com/na-trium-144/webcface-package/releases/download/v2.0.5/webcface_2.0.5_macos_universal.zip
curl -fLO https://github.com/na-trium-144/webcface-package/releases/download/v2.0.5/webcface-desktop_2.0.5_macos_app.zip
curl -fLO https://github.com/na-trium-144/webcface-package/releases/download/v2.1.0/webcface_2.1.0_macos_universal.zip
curl -fLO https://github.com/na-trium-144/webcface-package/releases/download/v2.1.0/webcface-desktop_2.1.0_macos_app.zip
```

sudo権限が使用できれば以下のように webcface_universal を /opt/webcface に、 webcface-desktop_app を /Applications に展開するのがおすすめです。
```sh
sudo unzip webcface_2.0.5_macos_universal.zip -d /opt/webcface
sudo unzip webcface-desktop_2.0.5_macos_app.zip -d /Applications
rm webcface_2.0.5_macos_universal.zip
rm webcface-desktop_2.0.5_macos_app.zip
sudo unzip webcface_2.1.0_macos_universal.zip -d /opt/webcface
sudo unzip webcface-desktop_2.1.0_macos_app.zip -d /Applications
rm webcface_2.1.0_macos_universal.zip
rm webcface-desktop_2.1.0_macos_app.zip
```

また、展開したディレクトリ内の bin/ をPATHに、 lib/pkgconfig/ をPKG_CONFIG_PATHに追加してください。
Expand Down
4 changes: 2 additions & 2 deletions docs/31_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ MesonまたはCMakeを使用する場合は、subproject/subdirectoryとしてWe
```
[wrap-git]
url = https://github.com/na-trium-144/webcface.git
revision = v2.0.5
revision = v2.1.0
depth = 1
[provide]
dependency_names = webcface
Expand Down Expand Up @@ -66,7 +66,7 @@ MesonまたはCMakeを使用する場合は、subproject/subdirectoryとしてWe
```cmake
FetchContent_Declare(webcface
GIT_REPOSITORY https://github.com/na-trium-144/webcface.git
GIT_TAG v2.0.5
GIT_TAG v2.1.0
)
FetchContent_MakeAvailable(webcface)
```
Expand Down
14 changes: 12 additions & 2 deletions docs/42_member.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,15 @@ C++のライブラリは `"cpp"`, Pythonのライブラリ(webcface-python)は`"

通信速度の情報は5秒に1回更新され、更新されたときにonPingイベントが発生します

デフォルトの状態ではpingの情報は受信しませんが、pingStatusまたはonPingに1回アクセスすることでpingの情報がリクエストされ、それ以降は値が送られてくるようになります。

<div class="tabbed">

- <b class="tab-title">C++</b>
Member::pingStatus() でmemberの通信速度(int型)を取得できます。
デフォルトの状態ではpingの情報は受信しておらずstd::nulloptを返しますが、
pingStatusに1回アクセスすることでpingの情報がリクエストされ、それ以降は値が送られてくるようになります。

また、 Member::onPing() でpingの情報が更新された時に実行するコールバックを設定できます。
onPing()を使うことでもリクエストが送られます。

<span class="since-c">2.0</span>
```cpp
Expand Down Expand Up @@ -296,6 +298,12 @@ C++のライブラリは `"cpp"`, Pythonのライブラリ(webcface-python)は`"
```

- <b class="tab-title">JavaScript</b>
Member.pingStatus でmemberの通信速度を取得できます。
デフォルトの状態ではpingの情報は受信しておらずnullを返しますが、
pingStatusに1回アクセスすることでpingの情報がリクエストされ、それ以降は値が送られてくるようになります。

また、 Member.onPing でpingの情報が更新された時に実行するコールバックを設定できます。
onPingを使うことでもリクエストが送られます。
```ts
import { Member } from "webcface";
wcli.member("foo").onPing.on((m: Member) => {
Expand All @@ -304,6 +312,8 @@ C++のライブラリは `"cpp"`, Pythonのライブラリ(webcface-python)は`"
```
* <span class="since-js">1.7</span>
自分自身のping値も取得できるようになりました。(`wcli.pingStatus`, `wcli.onPing`)
* <span class="since-js">1.8</span>
Member.requestPingStatus() で明示的にリクエストを送ることもできます。

- <b class="tab-title">Python</b>
```python
Expand Down
76 changes: 58 additions & 18 deletions docs/53_func.md
Original file line number Diff line number Diff line change
Expand Up @@ -466,25 +466,46 @@ Valueと同様、関数が存在するかどうかを取得することができ
* rejection(), rejectionW(): 関数が例外を返した場合そのエラーメッセージを表す文字列です。
またその場合 isError() がtrueになります。
```cpp
Promise res = wcli.member("foo").func("hoge").runAsync(1, "aa");
res.waitReach();
if(res.found()){
// 関数hogeが存在し、実行が開始された
res.waitFinish();
if(res.isError()){
// res.rejection() がエラーメッセージ
}else{
// res.response() が戻り値
}
}else{
// 関数hogeが存在しないか未接続で呼び出し失敗
}
```
\warning
<span class="since-c">2.0</span>
waitReach(), waitFinish() などで結果が返ってくるまで待機することができますが、
上の例のようにwaitReach(), waitFinish() などで結果が返ってくるまで待機することができますが、
これらが結果を受信するためには Client::sync() が必要なため、別スレッドでsync()が呼ばれていなければデッドロックします。
<span></span>
* `onReach()`, `onFinish()` で値が返ってきたときに実行されるコールバックを設定することができます。
* 引数にはそのPromise自身が渡されますが、(キャプチャするなどして)必要なければ引数なしの関数も設定可能です
* コールバックは Client::sync() の中から呼び出されます。
```cpp
Promise res = wcli.member("foo").func("hoge").runAsync(1, "aa");
res.onReach([](Promise res){
std::cout << "func hoge() " << res.found() ? "started" : "not started" << std::endl;
if(res.found()){
// 関数hogeが存在し、実行が開始された
}else{
// 関数hogeが存在しないか未接続で呼び出し失敗
}
});
res.onFinish([](Promise res){
if(!res.isError()){
double ans = res.response();
if(res.isError()){
// res.rejection() がエラーメッセージ
}else{
std::cout << "Error: " << res.rejection() << std::endl;
// res.response() が戻り値
}
});
```
Expand All @@ -494,6 +515,8 @@ Valueと同様、関数が存在するかどうかを取得することができ
したがってコールバックはどの状況で設定したとしても必ず1回呼ばれます。
(呼ばれたあとにコールバックを再設定したりしても2度目が呼ばれることはありません)
<span></span>
- <b class="tab-title">C</b>
wcfFuncRunAsync, (<span class="since-c">2.0</span> wcfFuncRunAsyncW)
で関数を呼び出し、完了を待たずに続行します。
Expand Down Expand Up @@ -534,22 +557,39 @@ Valueと同様、関数が存在するかどうかを取得することができ
<span></span>
- <b class="tab-title">JavaScript</b>
Func.runAsync() で関数を呼び出すと、戻り値として AsyncFuncResult クラスのオブジェクトが返り、後から関数の戻り値や例外を取得できます。
AsyncFuncResultからは started と result が取得できます。
* started は対象の関数が存在して実行が開始したときにtrueになり、指定したクライアントまたは関数が存在しなかった場合falseとなります。
* result は実行が完了したときに返ります。関数の戻り値、または発生した例外の情報を含んでいます。
startedとresultはPromiseです。awaitで待機したり、then()とcatch()でコールバックを設定できます。
詳細は [AsyncFuncResult](https://na-trium-144.github.io/webcface-js/classes/AsyncFuncResult.html) を参照してください
\note
<span class="since-js">1.8</span> C++の Promise 型に合わせて名前変更しました。
以前の名前もまだ使えます。
Func.runAsync() で関数を呼び出すと、戻り値として <del>AsyncFuncResult</del> FuncPromise
クラスのオブジェクトが返り、後から関数の戻り値や例外を取得できます。
<del>AsyncFuncResult</del> FuncPromise からは
<del>started</del> reach と
<del>result</del> finish
が取得できます。
いずれもPromise型で、awaitで待機したり、then()とcatch()でコールバックを設定できます。
* reach (started) は対象の関数が存在して実行が開始したときにtrueになり、指定したクライアントまたは関数が存在しなかった場合falseとなります。
* <span class="since-js">1.8</span>
runAsync呼び出し時にクライアントがサーバーに接続していなかった場合は、関数呼び出しメッセージを送信することなく即座にfalseが返ります
* finish (result) は実行が完了したときに返ります。関数の戻り値を返すか、または発生した例外のメッセージを含むErrorでrejectします。
* <span class="since-js">1.8</span> Rejectする値は常にError型になっています。
(1.7以前は関数がthrowしたオブジェクトをそのまま返していた)
```ts
import { AsyncFuncResult } from "webcface";
const res: AsyncFuncResult = wcli.member("foo").func("hoge").runAsync(1, "aa");
res.result.then((ret: number | boolean | string) => {
// ...
import { FuncPromise } from "webcface";
const res: FuncPromise = wcli.member("foo").func("hoge").runAsync(1, "aa");
res.reach.then((found: boolean) => {
if (found) {
// 関数hogeが存在し、実行が開始された
} else {
// 関数hogeが存在しないか未接続で呼び出し失敗
}
});
res.finish.then((ret: number | boolean | string) => {
// ret が戻り値
}).catch((e) => {
// ...
// (e as Error).message がエラーメッセージ
});
```
Expand Down
6 changes: 3 additions & 3 deletions meson.build
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project('webcface', 'c', 'cpp',
version: '2.0.5',
version: '2.1.0',
license: 'MIT',
meson_version: '>=1.3.0',
default_options: [
Expand All @@ -17,8 +17,8 @@ cxx = meson.get_compiler('cpp')
py = find_program('python3')

webcface_abi_major = '20' # ABIの破壊的変更で1増やす
webcface_abi_minor = '1' # ABIの追加で1増やす
webcface_webui_version = '1.8.0'
webcface_abi_minor = '2' # ABIの追加で1増やす
webcface_webui_version = '1.8.1'

webcface_description = 'Web-based IPC & Dashboard-like UI'
webcface_contact = 'na-trium-144@users.noreply.github.com'
Expand Down

0 comments on commit 6de51c2

Please sign in to comment.