Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tlm の Destination Flags で,複数配送先のパケットをそれぞれの配送先に送るときに,flag をその配送先のみにする #562

Merged
merged 2 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Docs/Core/communication.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ https://github.com/ut-issl/c2a-core/blob/e84ac663187adb7b9d51939f2228b9ecfa7ae29
- Destination Flags
- テレメトリ配送種別
- 同時に複数配送ができるように, flag で管理
- ただし,地上局でのパケット保存処理をシンプルにするためなどの理由で,配送の過程でそれぞれのフラグごとにバケットをバラす.つまり,オンボードサブネットワークから地上に送信されるパケットでは, 1 つの flag のみ立っている状態を基本とする.
- 今後拡張予定あり
- 現時点では以下
- `0b00000001`: Housekeeping Telemetry
Expand Down
31 changes: 19 additions & 12 deletions TlmCmd/packet_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ static PH_ACK PH_add_tl_cmd_(TLCD_ID id,
* @return PH_ACK
*/
static PH_ACK PH_add_utl_cmd_(TLCD_ID id, const CommonCmdPacket* packet);
static PH_ACK PH_add_tlm_to_pl(const CommonTlmPacket* packet, PacketList* pl, CTP_DEST_FLAG dest_flag);
static PH_ACK PH_add_ms_tlm_(const CommonTlmPacket* packet);
#ifdef DR_ENABLE
static PH_ACK PH_add_st_tlm_(const CommonTlmPacket* packet);
Expand Down Expand Up @@ -311,36 +312,42 @@ static PH_ACK PH_add_utl_cmd_(TLCD_ID id, const CommonCmdPacket* packet)
}


static PH_ACK PH_add_ms_tlm_(const CommonTlmPacket* packet)
static PH_ACK PH_add_tlm_to_pl(const CommonTlmPacket* packet, PacketList* pl, CTP_DEST_FLAG dest_flag)
{
PL_ACK ack = PL_push_back(&PH_ms_tlm_list, packet);
PL_Node* tail;
PL_ACK ack = PL_push_back(pl, packet);

if (ack != PL_SUCCESS) return PH_ACK_PL_LIST_FULL;

// 複数の配送先に配送されるパケットの分岐は終わっているため, dest flag を配送先のもののみにする.
// こうすることで, GS SW 側でのデータベース格納の処理がシンプルになる.
// PL_SUCCESS の場合,かならず tail に格納した packet がある.
// TODO: メモリコピーをなくすためにだいぶやんちゃな実装なので,ぱっといい方法が思いつくなら直す
tail = (PL_Node*)PL_get_tail(pl); // const_cast
CTP_set_dest_flags((CommonTlmPacket*)(tail->packet), (ctp_dest_flags_t)dest_flag);

meltingrabbit marked this conversation as resolved.
Show resolved Hide resolved
return PH_ACK_SUCCESS;
}


#ifdef DR_ENABLE
static PH_ACK PH_add_st_tlm_(const CommonTlmPacket* packet)
static PH_ACK PH_add_ms_tlm_(const CommonTlmPacket* packet)
{
PL_ACK ack = PL_push_back(&PH_st_tlm_list, packet);
return PH_add_tlm_to_pl(packet, &PH_ms_tlm_list, CTP_DEST_FLAG_MS);
}

if (ack != PL_SUCCESS) return PH_ACK_PL_LIST_FULL;

return PH_ACK_SUCCESS;
#ifdef DR_ENABLE
static PH_ACK PH_add_st_tlm_(const CommonTlmPacket* packet)
{
return PH_add_tlm_to_pl(packet, &PH_st_tlm_list, CTP_DEST_FLAG_ST);
}
#endif


#ifdef DR_ENABLE
static PH_ACK PH_add_rp_tlm_(const CommonTlmPacket* packet)
{
PL_ACK ack = PL_push_back(&PH_rp_tlm_list, packet);

if (ack != PL_SUCCESS) return PH_ACK_PL_LIST_FULL;

return PH_ACK_SUCCESS;
return PH_add_tlm_to_pl(packet, &PH_rp_tlm_list, CTP_DEST_FLAG_RP);
}
#endif

Expand Down