summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrant Thomsen <brant.thomsen@harman.com>2017-07-19 08:50:19 -0600
committerBrant Thomsen <brant.thomsen@harman.com>2017-07-19 08:50:19 -0600
commit10610585b4292b9642046a2c385f4cb9133ed326 (patch)
treecd954f9ba03fbdb8404e922846f42fbe86462a38
parent75a7a7f6a26085dfaa174f5e91fcbed1dc196cd1 (diff)
downloadOpen-AVB-10610585b4292b9642046a2c385f4cb9133ed326.tar.gz
GET_STREAM_INFO Implementation
Added code to fill in the response to a GET_STREAM_INFO request. Information for stream_id, stream_dest_mac, and stream_vlan_id are saved with the StreamIO descriptor for easy access. Don't display an error if openavbAVDECCGetRequestedState() or openavbAVDECCGetStreamingState() are called before the Talker/Listener has started.
-rw-r--r--lib/avtp_pipeline/acmp/openavb_acmp_sm_listener.c5
-rw-r--r--lib/avtp_pipeline/acmp/openavb_acmp_sm_talker.c5
-rw-r--r--lib/avtp_pipeline/aecp/openavb_aecp_sm_entity_model_entity.c65
-rw-r--r--lib/avtp_pipeline/aem/openavb_descriptor_stream_io_pub.h5
-rw-r--r--lib/avtp_pipeline/platform/Linux/avdecc/openavb_avdecc_pipeline_interaction.c4
5 files changed, 82 insertions, 2 deletions
diff --git a/lib/avtp_pipeline/acmp/openavb_acmp_sm_listener.c b/lib/avtp_pipeline/acmp/openavb_acmp_sm_listener.c
index 6395af68..27e2ae6f 100644
--- a/lib/avtp_pipeline/acmp/openavb_acmp_sm_listener.c
+++ b/lib/avtp_pipeline/acmp/openavb_acmp_sm_listener.c
@@ -526,6 +526,11 @@ void openavbAcmpSMListenerStateMachine()
// Save the response flags for reference later.
pDescriptorStreamInput->acmp_flags = response.flags;
+
+ // Save the stream information for reference later.
+ memcpy(pDescriptorStreamInput->acmp_stream_id, pRcvdCmdResp->stream_id, 8);
+ memcpy(pDescriptorStreamInput->acmp_dest_addr, pRcvdCmdResp->stream_dest_mac, 6);
+ pDescriptorStreamInput->acmp_stream_vlan_id = pRcvdCmdResp->stream_vlan_id;
}
}
diff --git a/lib/avtp_pipeline/acmp/openavb_acmp_sm_talker.c b/lib/avtp_pipeline/acmp/openavb_acmp_sm_talker.c
index 91dc7de5..16fa5495 100644
--- a/lib/avtp_pipeline/acmp/openavb_acmp_sm_talker.c
+++ b/lib/avtp_pipeline/acmp/openavb_acmp_sm_talker.c
@@ -651,6 +651,11 @@ void openavbAcmpSMTalker_updateStreamInfo(openavb_tl_data_cfg_t *pCfg)
// Save the response flags for reference later.
pDescriptorStreamOutput->acmp_flags = response->flags;
+ // Save the stream information for reference later.
+ memcpy(pDescriptorStreamOutput->acmp_stream_id, response->stream_id, 8);
+ memcpy(pDescriptorStreamOutput->acmp_dest_addr, response->stream_dest_mac, 6);
+ pDescriptorStreamOutput->acmp_stream_vlan_id = response->stream_vlan_id;
+
// Send the response.
openavbAcmpSMTalker_txResponse(OPENAVB_ACMP_MESSAGE_TYPE_CONNECT_TX_RESPONSE, response, OPENAVB_ACMP_STATUS_SUCCESS);
AVB_LOG_DEBUG("Sent a CONNECT_TX_RESPONSE command");
diff --git a/lib/avtp_pipeline/aecp/openavb_aecp_sm_entity_model_entity.c b/lib/avtp_pipeline/aecp/openavb_aecp_sm_entity_model_entity.c
index 12b1f1ed..75e6e7b3 100644
--- a/lib/avtp_pipeline/aecp/openavb_aecp_sm_entity_model_entity.c
+++ b/lib/avtp_pipeline/aecp/openavb_aecp_sm_entity_model_entity.c
@@ -405,6 +405,71 @@ void processCommand()
case OPENAVB_AEM_COMMAND_CODE_SET_STREAM_INFO:
break;
case OPENAVB_AEM_COMMAND_CODE_GET_STREAM_INFO:
+ {
+ openavb_aecp_command_data_get_stream_info_t *pCmd = &pCommand->entityModelPdu.command_data.getStreamInfoCmd;
+ openavb_aecp_response_data_get_stream_info_t *pRsp = &pCommand->entityModelPdu.command_data.getStreamInfoRsp;
+
+ pCommand->headers.status = OPENAVB_AEM_COMMAND_STATUS_NO_SUCH_DESCRIPTOR;
+
+ if (pRsp->descriptor_type == OPENAVB_AEM_DESCRIPTOR_STREAM_INPUT ||
+ pRsp->descriptor_type == OPENAVB_AEM_DESCRIPTOR_STREAM_OUTPUT) {
+ U16 configIdx = openavbAemGetConfigIdx();
+ openavb_aem_descriptor_stream_io_t *pDescriptorStreamIO = openavbAemGetDescriptor(configIdx, pCmd->descriptor_type, pCmd->descriptor_index);
+ if (pDescriptorStreamIO && pDescriptorStreamIO->stream) {
+ openavbAvdeccMsgStateType_t clientState = openavbAVDECCGetStreamingState(pDescriptorStreamIO, configIdx);
+
+ // Get the flags for the current status.
+ pRsp->flags = 0;
+ if (pDescriptorStreamIO->fast_connect_status >= OPENAVB_FAST_CONNECT_STATUS_IN_PROGRESS) {
+ pRsp->flags |= OPENAVB_AEM_SET_STREAM_INFO_COMMAND_FLAG_FAST_CONNECT;
+ }
+ if (openavbAvdeccGetSaveStateInfo(pDescriptorStreamIO->stream, NULL, NULL, NULL, NULL)) {
+ pRsp->flags |= OPENAVB_AEM_SET_STREAM_INFO_COMMAND_FLAG_SAVED_STATE;
+ }
+ if (clientState >= OPENAVB_AVDECC_MSG_RUNNING) {
+ pRsp->flags |= (pDescriptorStreamIO->acmp_flags &
+ (OPENAVB_ACMP_FLAG_CLASS_B |
+ OPENAVB_ACMP_FLAG_FAST_CONNECT |
+ OPENAVB_ACMP_FLAG_SUPPORTS_ENCRYPTED |
+ OPENAVB_ACMP_FLAG_ENCRYPTED_PDU));
+ pRsp->flags |= OPENAVB_AEM_SET_STREAM_INFO_COMMAND_FLAG_CONNECTED;
+ if (clientState == OPENAVB_AVDECC_MSG_PAUSED) {
+ pRsp->flags |= OPENAVB_AEM_SET_STREAM_INFO_COMMAND_FLAG_STREAMING_WAIT;
+ }
+
+ // Get the Stream ID.
+ memcpy(pRsp->stream_id, pDescriptorStreamIO->acmp_stream_id, 8);
+ if (memcmp(pRsp->stream_id, "\x00\x00\x00\x00\x00\x00\x00\x00", 8) != 0) {
+ pRsp->flags |= OPENAVB_AEM_SET_STREAM_INFO_COMMAND_FLAG_STREAM_ID_VALID;
+ }
+
+ // Get the Destination MAC Address.
+ memcpy(pRsp->stream_dest_mac, pDescriptorStreamIO->acmp_dest_addr, 6);
+ if (memcmp(pRsp->stream_id, "\x00\x00\x00\x00\x00\x00", 6) != 0) {
+ pRsp->flags |= OPENAVB_AEM_SET_STREAM_INFO_COMMAND_FLAG_STREAM_DEST_MAC_VALID;
+ }
+
+ // Get the Stream VLAN ID if the other stream identifiers are valid.
+ if (pDescriptorStreamIO->acmp_stream_vlan_id != VLAN_NULL &&
+ (pRsp->flags & (OPENAVB_AEM_SET_STREAM_INFO_COMMAND_FLAG_STREAM_ID_VALID | OPENAVB_AEM_SET_STREAM_INFO_COMMAND_FLAG_STREAM_DEST_MAC_VALID)) ==
+ (OPENAVB_AEM_SET_STREAM_INFO_COMMAND_FLAG_STREAM_ID_VALID | OPENAVB_AEM_SET_STREAM_INFO_COMMAND_FLAG_STREAM_DEST_MAC_VALID)) {
+ pRsp->stream_vlan_id = pDescriptorStreamIO->acmp_stream_vlan_id;
+ pRsp->flags |= OPENAVB_AEM_SET_STREAM_INFO_COMMAND_FLAG_STREAM_VLAN_ID_VALID;
+ }
+ }
+ // AVDECC_TODO: Add TALKER_FAILED flag support.
+
+ // Get the stream format.
+ openavbAemStreamFormatToBuf(&pDescriptorStreamIO->current_format, pRsp->stream_format);
+ pRsp->flags |= OPENAVB_AEM_SET_STREAM_INFO_COMMAND_FLAG_STREAM_FORMAT_VALID;
+
+ // AVDECC_TODO: Add support for msrp_accumulated_latency
+ // AVDECC_TODO: Add support for msrp_failure_bridge_id, and msrp_failure_code
+
+ pCommand->headers.status = OPENAVB_AEM_COMMAND_STATUS_SUCCESS;
+ }
+ }
+ }
break;
case OPENAVB_AEM_COMMAND_CODE_SET_NAME:
break;
diff --git a/lib/avtp_pipeline/aem/openavb_descriptor_stream_io_pub.h b/lib/avtp_pipeline/aem/openavb_descriptor_stream_io_pub.h
index 7aebccb8..ec4cd58b 100644
--- a/lib/avtp_pipeline/aem/openavb_descriptor_stream_io_pub.h
+++ b/lib/avtp_pipeline/aem/openavb_descriptor_stream_io_pub.h
@@ -89,6 +89,11 @@ typedef struct {
// OPENAVB_ACMP_FLAG values from CONNECT_TX_RESPONSE or CONNECT_RX_RESPONSE.
U16 acmp_flags;
+ // Streaming values for GET_STREAM_INFO from CONNECT_TX_RESPONSE or CONNECT_RX_RESPONSE.
+ U8 acmp_stream_id[8];
+ U8 acmp_dest_addr[6];
+ U16 acmp_stream_vlan_id;
+
// Also save a pointer to the supplied stream information.
const openavb_tl_data_cfg_t *stream;
diff --git a/lib/avtp_pipeline/platform/Linux/avdecc/openavb_avdecc_pipeline_interaction.c b/lib/avtp_pipeline/platform/Linux/avdecc/openavb_avdecc_pipeline_interaction.c
index be8db04a..5ff27285 100644
--- a/lib/avtp_pipeline/platform/Linux/avdecc/openavb_avdecc_pipeline_interaction.c
+++ b/lib/avtp_pipeline/platform/Linux/avdecc/openavb_avdecc_pipeline_interaction.c
@@ -291,7 +291,7 @@ openavbAvdeccMsgStateType_t openavbAVDECCGetRequestedState(openavb_aem_descripto
return OPENAVB_AVDECC_MSG_UNKNOWN;
}
if (!pDescriptorStream->stream->client) {
- AVB_LOG_ERROR("openavbAVDECCGetRequestedState Invalid stream client pointer");
+ AVB_LOG_DEBUG("openavbAVDECCGetRequestedState Invalid stream client pointer");
AVB_TRACE_EXIT(AVB_TRACE_AVDECC);
return OPENAVB_AVDECC_MSG_UNKNOWN;
}
@@ -317,7 +317,7 @@ openavbAvdeccMsgStateType_t openavbAVDECCGetStreamingState(openavb_aem_descripto
return OPENAVB_AVDECC_MSG_UNKNOWN;
}
if (!pDescriptorStream->stream->client) {
- AVB_LOG_ERROR("openavbAVDECCGetStreamingState Invalid stream client pointer");
+ AVB_LOG_DEBUG("openavbAVDECCGetStreamingState Invalid stream client pointer");
AVB_TRACE_EXIT(AVB_TRACE_AVDECC);
return OPENAVB_AVDECC_MSG_UNKNOWN;
}