规范标准

Publish/Subscribe with link loss at client (figure ignoring timings)

Publish/Subscribe Registration/Deregistration behavior (figure ignoring timings)

Publish/Subscribe with link loss at Server (figure ignoring timings)

Publish/Subscribe State Diagram (server behavior for unicast eventgroups)

Publish/Subscribe State Diagram (server behavior for multicast eventgroups

Publish/Subscribe State Diagram (server behavior for adaptive unicast/multicast eventgroups)

Publish/Subscribe Example for Endpoint Options and the usage of ports

  • Example
  • following Figure shows an example with the different Endpoint and a Multicast Option:
    下图展示了一个例子,使用不同的Endpoint和Multicast Option
    • The Server offers the Service Instance on Server UDP-Endpoint SU and Server TCP-Endpoint ST
      服务器提供了一个服务实例,通过UDP-Endpoint (简称SU) 和 TCP-Endpoint ST(简称ST)
    • The Client opens a TCP connection
      客户端打开一个TCP连接(Socket)
    • The Client sends a Subscribe Eventgroup entry with Client UDP-Endpoint CU (unicast) and a Client TCP-Endpoint CT
      客户端发送一个Subscribe Eventgroup entry,带有客户端UDP-Endpoint (unicast)(简称CU)和一个客户端TCP-Endpoint (简称CT)
    • The Server answers with a Subscribe Eventgroup Ack entry with Multicast MU
      服务器通过多播option(简称MU)回复一个Subscribe Eventgroup Ack entry
  • Then the following operations happen:
    接下来这么运行:
    • The Client calls a method on the Server
      客户端调用服务器端的method
    • Request is sent from CU to SU and Response from SU to CU
      Request从客户端通过UDP发给服务器端,回复消息从服务器端通过UDP发回客户端
    • For TCP this would be: Request dyn to ST and RESPONSE from ST to CT
    • The Server sends a Unicast UDP Event: SU to CU
      服务器端发送一个Unicast UDP Event:到客户端:SU到CU
    • The Server sends a Unicast TCP Event: ST to CT
      服务器端发送一个Unicast TCP Event到客户端: ST到CT.
    • The Server sends a Multicast UDP Event: SU to MU
      服务器端发送一个Multicast UDP Event到客户端:SU到MU
  • Keep in mind that Multicast Endpoints use a Multicast IP Address on the receiver side,i.e. the client, and TCP cannot be used for Multicast

  • If the Service Discovery Module receives an OfferService Entry, the following step(s) shall be performed in the following order:
    如果服务发现模块收到OfferService entry,则应按以下顺序执行以下步骤:
    • If received TTL is not equal to the max value, update the timer by the received TTL value.
      如果收到的TTL不等于最大值,则按接收的TTL值更新定时器。
    • Open TCP connection if SdClientServiceTcpRef is configured and was not opened before.
      如果配置了SdClientServiceTcpRef并且之前未打开,则打开TCP连接。
  • Note注意:
    The amount of separate Service Discovery messages shall be reduced, i.e.: Combine as much information as possible into one Service Discovery message before calling the Socket Adaptor’s transmit API. 应减少单独的Service Discovery消息的数量,即:在调用套接字适配器的传输API之前,将尽可能多的信息合并到一个服务发现消息中。
  • If an OfferService entry was received and its TTL timer did not expire yet, the associated Socket Connections are in state SOAD_SOCON_ONLINE in the Main phase:
    如果在主阶段收到OfferService entry且其TTL计时器尚未到期,相关的套接字连接处于状态SOAD_SOCON_ONLINE:
    • If the client service has not been reported as SD_CLIENT_SERVICE_AVAILABLE:
      如果客户端服务尚未报告为SD_CLIENT_SERVICE_AVAILABLE:
      • the API SoAd_EnableSpecificRouting() shall be called with SdClientServiceActivationRef (see SdConsumedMethods) and the relevant Socket Connections for this Client Service Instance.
        应使用SdClientServiceActivationRef(请参阅SdConsumedMethods)和此客户端服务实例的相关套接字连接来调用API SoAd_EnableSpecificRouting()。
      • SD_CLIENT_SERVICE_AVAILABLE shall be indicated to the BswM module by calling the API BswM_Sd_ClientServiceCurrentState().
        应通过调用API BswM_Sd_ClientServiceCurrentState()向BswM模块指示SD_CLIENT_SERVICE_AVAILABLE。
  • If an OfferService entry was received and its TTL timer did not expire yet, the associated Socket Connections are in state SOAD_SOCON_ONLINE in the Main phase:
    如果在主阶段收到OfferService entry且其TTL计时器尚未到期,且相关的套接字连接处于状态SOAD_SOCON_ONLINE:
    • For each currently requested Consumed Eventgroup of this Client Service Instance (Consumed Eventgroups are requested using Sd_ConsumedEventGroupSetState() and with state SD_CONSUMED_EVENTGROUP_REQUESTED or automatically on startup if SdConsumedEventGroupAutoRequire is configured to true), the following shall be done in exactly this order:
      对于此客户端服务实例的每个当前请求的Consumed Eventgroup (使用Sd_ConsumedEventGroupSetState()和状态SD_CONSUMED_EVENTGROUP_REQUESTED请求Consumed Eventgroups ,或者如果SdConsumedEventGroupAutoRequire配置为true,则在启动时自动启用),以下内容应按以下顺序完成:
      • StopSubscribeEventgroup entry shall be sent out, if the last SubscribeEventgroup entry was sent as reaction to an OfferService entry received via Multicast, it was never answered with a SubscribeEventgroupAck, and the current OfferService entry was received via Multicast.
        如果最后一个SubscribeEventgroup entry作为对OfferService entry的响应而发送,它从未通过SubscribeEventgroupAck被回复,并且当前的OfferService entry是通过Multicast接收的,则发送StopSubscribeEventgroup entry。
      • A SubscribeEventgroup entry shall be sent out.
        然后发送SubscribeEventgroup entry。
  • Note:
    • The transmission of a response to an Offer received via multicast shall be delayed with the configured delay.
      通过多播接收的Offer的响应消息的传输应被延迟,这个延迟可以被配置。
    • When the request response delay elapses before the associated Socket Connections are in state SOAD_SOCON_ONLINE, the StopSubscribeEventgroup and SubscribeEventgroup shall be delayed until the Socket Connections are online and shall not be considered as reaction to an OfferService entry received via Multicast.
      当在关联的套接字连接处于SOAD_SOCON_ONLINE状态之前请求响应延迟已经结束,StopSubscribeEventgroup和SubscribeEventgroup将被延迟,直到Socket Connections在线,并且不应被视为对通过Multicast接收的OfferService entry的反应。
    • When the request response delay elapses while the ClientService is in state RELEASED, there shall be no response to this Offer entry.
      当ClientService处于RELEASED状态时,如果请求响应延迟已经结束,则不会对此Offer entry 做出响应。
  • When the Client Service is reported as SD_CLIENT_SERVICE_DOWN to the BswM by calling the API BswM_Sd_ClientServiceCurrentState() :
    当通过调用API BswM_Sd_ClientServiceCurrentState()将客户端服务向BswM报告为SD_CLIENT_SERVICE_DOWN:
    • The API SoAd_DisableSpecificRouting() shall be called with SdClientServiceActivationRef (see SdConsumedMethods) and the relevant Socket Connections for this Client Service Instance.
      应使用SdClientServiceActivationRef(请参阅SdConsumedMethods)和此客户端服务实例相关的套接字连接去调用API SoAd_DisableSpecificRouting()。
  • If a StopSubscribeEventgroup and SubscribeEventgroup for the same Eventgroup (i.e. same Service ID, Instance ID, Eventgroup ID, Counter, and Major Version) have to be sent out, these entries have to be directly after each other in the same SD message (no entry between them).
    对于相同事件组(即相同的服务ID,实例ID,事件组ID,计数器和主版本),如果必须发送StopSubscribeEventgroup和SubscribeEventgroup,则这些entry必须在相同的SD消息中直接相继连续发送,而无entry在它们之间。
    • StopSubscribeEventgroup entry shall be sent out, if the last SubscribeEventgroup entry was sent as reaction to an OfferService entry received via Multicast, it was never answered with a SubscribeEventgroupAck, and the current OfferService entry was received via Multicast.
      如果发送最后一个SubscribeEventgroup entry是用来响应OfferService entry,但从没有收到SubscribeEventgroupAck,且这个OfferService entry是以Multicast接收到的,则StopSubscribeEventgroup entry需要被发送。
    • A SubscribeEventgroup entry shall be sent out .
      然后发送SubscribeEventgroup entry。
  • If the Service Discovery Module receives a SubscribeEventgroupAck fitting this Consumed Eventgroup for the first time after this Consumed Eventgroup was requested, the following step(s) shall be performed in the following order:
    如果服务发现模块在请求此Consumed Eventgroup后第一次收到适合此Consumed Eventgroup的SubscribeEventgroupAck,则应按以下顺序执行以下步骤:
    • Use the information of the Multicast Option (if existing) to set up relevant Multicast Information in SoAd (see SoConId related to SdConsumedEventGroupMulticastActivationRef).
      使用Multicast Option (如果存在)的信息在SoAd中设置相关的多播信息(请参阅与SdConsumedEventGroupMulticastActivationRef相关的SoConId)。
    • Call the API SoAd_RequestIpAddrAssignment() using the IP address received by the SubscribeEventgroupAck message.
      使用SubscribeEventgroupAck消息接收的IP地址调用API SoAd_RequestIpAddrAssignment()。
    • Call BswM_Sd_ConsumedEventGroupCurrentState with SD_CONSUMED_EVENTGROUP_AVAILABLE.
      使用SD_CONSUMED_EVENTGROUP_AVAILABLE调用BswM_Sd_ConsumedEventGroupCurrentState。
    • Setup TTL timer with the TTL of the SubscribeEventgroupAck entry.
      使用SubscribeEventgroupAck entry的TTL设置TTL计时器。
  • If a Service Discovery Message contains only a SubscribeEventgroupNack entry but no SubscribeEventgroupAck entry for the same Eventgroup, Service Discovery shall do the following:
    如果服务发现消息仅包含SubscribeEventgroupNack entry但不包含同一事件组的SubscribeEventgroupAck entry,则Service Discovery将执行以下操作:
    • Report the DEM error SD_E_SUBSCR_NACK_RECV (and restart the TCP connection (if applicable)
      报告DEM错误SD_E_SUBSCR_NACK_RECV 并重新启动TCP连接(如果适用)
    • call the API SoAd_CloseSoCon()with parameter abort set to TRUE to close all socket connections associated to this service instance
      将参数abort设置为TRUE并调用API SoAd_CloseSoCon()以关闭与此服务实例关联的所有套接字连接
    • call the API SoAd_OpenSoCon() to reopen all socket connections associated to this service instance
      调用API SoAd_OpenSoCon()以重新打开与此服务实例关联的所有套接字连接
  • If the Service Discovery Module receives a StopOfferService Entry, the following step(s) shall be performed in the following order:
    如果服务发现模块收到StopOfferService条目,则应按以下顺序执行以下步骤:
    • Stop the TTL timers of this Client Service Instance and all related Consumed Eventgroups.
      停止此客户端服务实例和所有相关的Consumed Eventgroup的TTL计时器。
    • Report this Client Service as DOWN if it was reported AVAILABLE before (call BswM_Sd_ClientServiceCurrentState with SD_CLIENT_SERVICE_DOWN and the Client Service’s handle ID)
      如果之前报告了AVAILABLE,则将此客户端服务报告为DOWN(使用SD_CLIENT_SERVICE_DOWN和客户服务的句柄ID调用BswM_Sd_ClientServiceCurrentState)。
    • Report all Consumed Eventgroups as DOWN that were reported AVAILABLE before (call BswM_Sd_ConsumedEventGroupCurrentState with SD_CONSUMED_EVENTGROUP_DOWN and the Consumed Eventgroup’s handle ID).
      将之前报告为AVAILABLE的所有Consumed Eventgroup报告为DOWN(使用SD_CONSUMED_EVENTGROUP_DOWN和Consumed Eventgroups的句柄ID调用BswM_Sd_ConsumedEventGroupCurrentState)。
    • Close all Socket Connections associated with this Client Service Instance that have been opened before.
      关闭之前打开的与此客户端服务实例关联的所有套接字连接。
    • Stay in Main Phase and do not send FindService entries.
      保持主阶段,不发送FindService条目。
  • If Sd_LocalIpAddrAssignmentChg() is called with a state other than “TCPIP_IPADDR_STATE_ASSIGNED” while being in Main Phase:
    如果在主阶段中调用Sd_LocalIpAddrAssignmentChg() 时状态不是“TCPIP_IPADDR_STATE_ASSIGNED”:
    • The Down Phase shall be entered. 应进入Down Phase。
    • “SD_CLIENT_SERVICE_DOWN” shall be indicated to the BswM module by calling the API BswM_Sd_ClientServiceCurrentState(), if the present state is SD_CLIENT_SERVICE_AVAILABLE.
      如果当前状态为SD_CLIENT_SERVICE_AVAILABLE,则应通过调用API BswM_Sd_ClientServiceCurrentState()向BswM模块指示“SD_CLIENT_SERVICE_DOWN”。
    • “SD_CONSUMED_EVENTGROUP_DOWN” shall be indicated to the BswM module by calling the API BswM_Sd_ConsumedEventGroupCurrentState() for all associated ConsumedEventgroups, if the present state is SD_CONSUMED_EVENTGROUP_AVAILABLE.
      如果当前状态为SD_CONSUMED_EVENTGROUP_AVAILABLE,则应通过为所有关联的ConsumedEventgroup调用API BswM_Sd_ConsumedEventGroupCurrentState()向BswM模块表明“SD_CONSUMED_EVENTGROUP_DOWN”。
  • If the TCP/IP connection has been lost (Socket connection is other than SOAD_SOCON_ONLINE), the Service Discovery Module shall leave the Main Phase, enter the Wait Phase, and stop the TTL timers of the associated Client Service Instances and EventGroups.
    如果TCP / IP连接丢失(套接字连接不是SOAD_SOCON_ONLINE),服务发现模块应离开主阶段,进入等待阶段,并停止相关客户端服务实例和事件组的TTL定时器。
  • The Service Discovery Module shall stay in the Main Phase as long as the following conditions apply:
    只要满足以下条件,服务发现模块应保持在主阶段:
    • Client Service is needed (i.e. Sd_ClientServiceSetState()has been called with State “SD_CLIENT_SERVICE_REQUESTED”)
      需要客户端服务(即已使用状态“SD_CLIENT_SERVICE_REQUESTED”调用Sd_ClientServiceSetState()
    • IP address assigned and can be used (i.e. Sd_LocalIpAddrAssignmentChg has been called with status TCPIP_IPADDR_STATE_ASSIGNED).
      分配并可以使用的IP地址(即已调用状态为TCPIP_IPADDR_STATE_ASSIGNED的Sd_LocalIpAddrAssignmentChg)。
  • The Service Discovery Module shall leave the Main Phase and enter the state SD_CLIENT_SERVICE_DOWN if at least one of the listed conditions described as above does not apply any more.
    如果上述至少一个列出的条件不再适用,则服务发现模块应离开主阶段并进入状态SD_CLIENT_SERVICE_DOWN。
  • If the Client goes DOWN which is indicated by a call of Sd_ClientServiceSetState () with State “SD_CLIENT_SERVICE_RELEASED” while all other conditions listed in SWS_SD_00375 still apply, the Service Discovery module shall perform the following steps:
    如果客户端进入DOWN,这是通过调用状态为“SD_CLIENT_SERVICE_RELEASED”的API Sd_ClientServiceSetState()引发的,而SWS_SD_00375(上页)中列出的所有其他条件仍然适用,则服务发现模块应执行以下步骤:
    • Enter the Down Phase and indicate the state SD_CLIENT_SERVICE_DOWN to the BswM by calling the API BswM_Sd_ClientServiceCurrentState ().
      进入Down Phase并通过调用API BswM_Sd_ClientServiceCurrentState()向BswM指示状态SD_CLIENT_SERVICE_DOWN。
    • For all subscribed eventgroups of this Client Service,
      对于此客户服务的所有订阅事件组,
      • a StopSubscribeEventgroup shall be sent
        应发送StopSubscribeEventgroup。
      • the status shall be set to SD_CONSUMED_EVENTGROUP_DOWN and reported to BswM by calling the API BswM_Sd_ConsumedEventGroupCurrentState().
        状态应设置为SD_CONSUMED_EVENTGROUP_DOWN并通过调用API BswM_Sd_ConsumedEventGroupCurrentState()报告给BswM_Sd_ConsumedEventGroupCurrentState(),
  • If the Consumed Event Group is not requested anymore as indicated by a call of Sd_ConsumedEventGroupSetState with state SD_CONSUMED_EVENTGROUP_RELEASED, the Service Discovery module shall perform the following steps for the consumed event group:
    如果通过调用状态为SD_CONSUMED_EVENTGROUP_RELEASED的Sd_ConsumedEventGroupSetState表明不再请求Consumed Event Group ,则服务发现模块将对Consumed Event Group执行以下步骤:
    • A StopSubscribeEventgroup shall be sent.
      应发送StopSubscribeEventgroup。
    • The status shall be set to SD_CONSUMED_EVENTGROUP_DOWN and be reported to BswM_Sd_ConsumedEventGroupCurrentState(), if the status is not currently SD_CONSUMED_EVENTGROUP_DOWN.
      如果状态当前不是SD_CONSUMED_EVENTGROUP_DOWN,则状态应设置为SD_CONSUMED_EVENTGROUP_DOWN并报告给BswM_Sd_ConsumedEventGroupCurrentState
  • If the TTL Timer of a Client Service expires, the Service Discovery module shall perform the following steps:
    如果客户端Service的TTL定时器到期,则服务发现模块应执行以下步骤:
    • Enter the Initial Wait Phase and indicate the state SD_CLIENT_SERVICE_DOWN to the BswM by calling the API BswM_Sd_ClientServiceCurrentState ().
      输入初始等待阶段,并通过调用API BswM_Sd_ClientServiceCurrentState()向BswM提供状态信息SD_CLIENT_SERVICE_DOWN。
    • All subscribed Eventgroups of this Client Service shall expired in this instance (stop TTL timer) and the expiration shall be handled as describe in SWS_SD_00601.
      此客户端服务的所有已订阅事件组在此实例中将到期(停止TTL计时器),并且应按照SWS_SD_00601中的描述处理该到期失效。
  • If the TTL Timer of an Eventgroup expires, the Service Discovery module shall perform the following step(s):
    如果Eventgroup的TTL定时器到期,则服务发现模块应执行以下步骤:
    • The status shall be set to SD_CONSUMED_EVENTGROUP_DOWN and reported to BswM by calling the API BswM_Sd_ConsumedEventGroupCurrentState().
      状态应设置为SD_CONSUMED_EVENTGROUP_DOWN,并通过调用API BswM_Sd_ConsumedEventGroupCurrentState()报告给BswM。
  • When the Main Phase is left,
    当主阶段离开时,
    • The API SoAd_DisableSpecificRouting()shall be called for all Socket Connections associated with this Client Service ID that have been opened before.
      应为之前打开过的与此客户端服务ID关联的所有套接字连接调用API SoAd_DisableSpecificRouting。
    • Close all Socket Connections associated with this Client Service Instance that have been opened before.
      关闭之前打开的与此客户端服务实例关联的所有套接字连接。

  • When the Repetition Phase is entered, the Service Discovery Module shall start the timer SdClientTimerInitialFindRepetitionsBaseDelay ?()
    当进入Repetition阶段后,服务发现模块应启动计时器SdClientTimerInitialFindRepetitionsBaseDelay
  • When the timer SdClientTimerInitialFindRepetitionsBaseDelay expires within the Repetition Phase, a FindOffer Message shall be sent. ?()
    当计时器SdClientTimerInitialFindRepetitionsBaseDelay在重复阶段到期时,应发送FindOffer消息。
  • In the Repetition Phase up to SdClientTimerInitialFindRepetitionsMax FindServer entries shall be sent with doubling intervals (BaseDelay, first FindService Entry, 2x BaseDelay, second FindService Entry, 4x BaseDelay, third FindService Entry, …).
    在重复阶段,直到SdClientTimerInitialFindRepetitionsMax FindServer条目应以双倍间隔发送(BaseDelay,第一个FindService条目,2x BaseDelay,第二个FindService条目,4x BaseDelay,第三个FindService条目,……)。
  • Note: Example config and resulting behavior (no OfferService received during example):

SdClientTimerInitialFindRepetitionBaseDelay=30
SdClientTimerInitialFindRepetitionMax=3

[Initial Wait Phase starts]
Wait Initial Wait Delay based on Configured Min and Max
Send entry.
[Initial Wait Phase ends]

[Repetition Phase starts]
Wait 30ms (=30ms * 20).
Send entry.

Wait 60ms (=30ms * 21).
Send entry.

Wait 120ms (=30ms * 22).
Send entry.
[Repetition Phase ends]

  • If the Service Discovery Module receives an OfferService Entry while the current state SD_CLIENT_SERVICE_REQUESTED is for this Client Service Instance, the following step(s) shall be performed in the following order:
    如果服务发现模块收到OfferService条目,而该服务实例的当前状态是SD_CLIENT_SERVICE_REQUESTED,则应按以下顺序执行以下步骤:
    • Cancel the repetition timer.
      取消重复计时器。
    • If received TTL is not equal to the max value, set the TTL timer for this entry to the received TTL value.
      如果收到的TTL不等于最大值,则将该条目的TTL定时器设置为接收的TTL值。
    • Open TCP connection if SdClientServiceTcpRef is configured and was not opened before.
      如果配置了SdClientServiceTcpRef并且之前未打开,则打开TCP连接。
    • Leave the Repetition Phase immediately and enter the Main Phase.
      立即离开Repetition阶段并进入Main阶段。
  • After sending the maximum repetitions (defined by SdClientTimerInitialFindRepetitionsMax) of FindService entries, the Repetition Phase shall be left and the Main Phase shall be entered.
    在发送FindService条目的最大重复次数(由SdClientTimerInitialFindRepetitionsMax定义)后,应离开Repetition阶段并输入Main阶段。
  • If Sd_ClientServiceSetState()is called with state SD_CLIENT_SERVICE_RELEASED while being in Repetition Phase, this phase shall be left and the service instance shall enter Down Phase.
    如果在处于Repetition阶段时使用状态SD_CLIENT_SERVICE_RELEASED调用Sd_ClientServiceSetState(),则应离开此阶段,并且服务实例应进入Down Phase。
  • If Sd_LocalIpAddrAssignmentChg() is called with a state other than “TCPIP_IPADDR_STATE_ASSIGNED” while being in Repetition Phase the Down Phase shall be entered.
    如果在处于Repetition阶段时使用“TCPIP_IPADDR_STATE_ASSIGNED”以外的状态调用Sd_LocalIpAddrAssignmentChg(),则应输入Down Phase。
  • If the TCP/IP connection has been lost (Socket connection is other than SOAD_SOCON_ONLINE), the Service Discovery Module shall leave the Repetition Phase, enter the Wait Phase, and stop the TTL timers of the associated Client Service Instances and EventGroups.
    如果TCP / IP连接丢失(套接字连接不是SOAD_SOCON_ONLINE),服务发现模块应离开Repetition阶段,进入Wait阶段,并停止相关客户端服务实例和事件组的TTL定时器。
  • If the following conditions apply, the Initial Wait Phase for this configured Client Service Instance shall be entered:
    如果满足以下条件,则应进入此已配置客户端服务实例的Initial Wait Phase
    • Sd_Init() has been called.
      已调用Sd_Init()
    • Sd_ClientServiceSetState() with SD_CLIENT_SERVICE_REQUESTED has been called OR SdClientServiceAutoRequired = TRUE.
      已调用状态为SD_CLIENT_SERVICE_REQUESTED的Sd_ClientServiceSetState()或SdClientServiceAutoRequired = TRUE。
    • Sd_LocalIpAddrAssignmentChg() with state “TCPIP_IPADDR_STATE_ASSIGNED” has been called for the first IpAddrId associated with the SdInstanceTxPdu.
      已为与SdInstanceTxPdu关联的第一个IpAddrId调用状态为“TCPIP_IPADDR_STATE_ASSIGNED”的Sd_LocalIpAddrAssignmentChg()。
  • When the Initial Wait Phase is entered, the API SoAd_EnableSpecificRouting() shall be called with SdClientServiceActivationRef (see SdConsumedMethods) and the relevant Socket Connections for this Client Service Instance.
    进入Initial Wait Phase后,应使用SdClientServiceActivationRef(请参阅SdConsumedMethods)和此客户端服务实例的相关套接字连接调用API SoAd_EnableSpecificRouting()。
  • When a OfferService for a required Client Service is received and SoAd_OpenSoCon()was not called before, the API SoAd_OpenSoCon() shall be called for all Socket Connections associated with this Client Service Instance.
    当收到所需客户端服务的OfferService并且之前未调用SoAd_OpenSoCon()时,API SoAd_OpenSoCon()应被调用,以满足此客户端服务实例关联的所有套接字连接的需要。
  • This Client Service Instance shall stay in the Initial Wait Phase for a time within the configured range of SdClientTimerInitialFindDelayMin and SdClientTimerInitialFindDelayMax unless an OfferService entry for this Client Service Instance is received or this random timer expires.
    此客户端服务实例应在SdClientTimerInitialFindDelayMin和SdClientTimerInitialFindDelayMax的配置范围内保持初始等待阶段一段时间,除非收到对此客户端服务实例的OfferService entry或此随机计时器到期。
  • If an OfferService Entry for this Client Service Instance is received within the Initial Wait Phase,
    如果在初始等待阶段内收到此客户服务实例的OfferService entry,
    • The calculated random timer, which has been started when entering the Initial Wait Phase, shall be canceled.
      计算的随机计时器(在进入初始等待阶段时已启动)将被取消。
    • If received TTL is not equal to the max value, set the TTL timer for this entry to the received TTL value.
      如果收到的TTL不等于最大值,请将此条目的TTL定时器设置为接收的TTL值。
    • Open TCP connection if SdClientServiceTcpRef is configured and was not opened before.
      如果配置了SdClientServiceTcpRef且之前未打开,则打开TCP连接。
    • Leave the Initial Wait Phase Enter the Main Phase.
      离开初始等待阶段进入主阶段。
  • When the calculated random timer based on the parameters SdClientTimerInitialFindDelayMin and SdClientTimerInitialFindDelayMax expires (i.e. no OfferService has been received within this timespan), the following shall be done in the following order:
    当基于参数SdClientTimerInitialFindDelayMin和SdClientTimerInitialFindDelayMax的计算随机计时器到期时(即在此时间段内未收到OfferService),应按以下顺序进行以下操作:
    • FindService Entry shall be sent.
      应发送FindService Entry
    • If the SdClientTimerInitialFindRepetitionsMax>0, enter the Repetition Phase
      如果SdClientTimerInitialFindRepetitionsMax> 0,则进入重复阶段
    • If the SdClientTimerInitialFindRepetitionsMax=0, enter the Main Phase
      如果SdClientTimerInitialFindRepetitionsMax = 0,则进入主阶段
  • If Sd_ClientServiceSetState() is called with state SD_CLIENT_SERVICE_RELEASED while being in Initial Wait Phase, this phase shall be left and the Service shall enter Down Phase.
    如果在初始等待阶段使用状态SD_CLIENT_SERVICE_RELEASED调用Sd_ClientServiceSetState(),则服务应离开此阶段并进入Down Phase。
  • If for any reasons the Initial Wait Phase is left, the calculated random timer (of the Initial Wait Phase) for this Service Instance shall be stopped.
    如果出于任何原因离开初始等待阶段,则应停止为此服务实例计算的(初始等待阶段的)随机定时器。
  • If Sd_LocalIpAddrAssignmentChg() is called with a state other than “TCPIP_IPADDR_STATE_ASSIGNED” while being in Initial Wait Phase, the Down Phase shall be entered.
    如果在初始等待阶段中调用Sd_LocalIpAddrAssignmentChg()并且状态不是“TCPIP_IPADDR_STATE_ASSIGNED”,则应进入Down阶段。
  • If the API Sd_Init() is called while being in Initial Wait Phase, the Down Phase shall be entered.
    如果在初始等待阶段调用API Sd_Init(),则应进入Down阶段。

Timings and repetitions for Client Service and Consumed Eventgroups

  • The Service Discovery phases allow minimizing the number of Service Discovery messages sent while allowing for very fast synchronization upon ECU start.
    Service Discovery各阶段允许最小化发送的Service Discovery消息的数量,同时允许在ECU启动时进行非常快速的同步
  • This de-emphasis is realized by the following Phases:
    • Down
    • Requested
      • Initial Wait Phase
      • Repetition Phase
      • Main Phase

Down Phase for Client Services

  • As long as a service is not requested by the BswM, the Service Discovery shall not send FindService Entry entries.
    只要BswM没有请求服务, Service Discovery就不应发送FindService Entry。
  • If an OfferService Entry is received during Down Phase,
    如果在Down阶段收到OfferService entry,
    • The Service Discovery shall store the state of this Service instance.
      ServiceDiscovery应存储此Service实例的状态。
    • A timer shall be set/reset to the TTL value of the received OfferService entry (TTL timer).
      计时器应设置/重置为收到的OfferService条目(TTL计时器)的TTL值。
    • Until the TTL Timer expires or a StopOfferService entry is received, the Service instance is considered Available.
      在TTL计时器到期或收到StopOfferService条目之前,服务实例被视为可用。
  • If Sd_ClientServiceSetState() is called with state SD_CLIENT_SERVICE_REQUESTED while being in Down Phase:
    如果在处于Down Phase状态时调用状态为SD_CLIENT_SERVICE_REQUESTED的API Sd_ClientServiceSetState():
    • If no OfferService entry was received before or its TTL timer expired already:
      如果之前未收到OfferService条目或其TTL计时器已到期:
      • The Initial Wait Phase shall be entered,
        应进入初始等待阶段,
    • If an OfferService entry was received and its TTL timer did not expire yet:
      如果收到OfferService条目且其TTL计时器尚未到期:
      • If SoAd_OpenSoCon() was not called before, the API SoAd_OpenSoCon() shall be called for all Socket Connections associated with this Client Service Instance.
        如果之前未调用SoAd_OpenSoCon(),则应为与此客户端服务实例关联的所有套接字连接调用API SoAd_OpenSoCon()。
      • The API SoAd_EnableSpecificRouting() shall be called with SdClientServiceActivationRef (see SdConsumedMethods) and the relevant Socket Connections for this Client Service Instance.
        应使用SdClientServiceActivationRef(请参阅SdConsumedMethods)和此客户端服务实例的相关套接字连接来调用API SoAd_EnableSpecificRouting()。
      • Open TCP connection if SdClientServiceTcpRef is configured and was not opened before.
        如果配置了SdClientServiceTcpRef并且之前未打开,则打开TCP连接。
      • The Main Phase shall be entered.
        应当进入Main阶段。

新锦江官网