• 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.
      关闭之前打开的与此客户端服务实例关联的所有套接字连接。

新锦江官网