UnityServiceSubscriber.cs 627 B

123456789101112131415161718192021
  1. /* author: Jana-Sophie Schönfeld
  2. */
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. namespace RosSharp.RosBridgeClient
  7. {
  8. [RequireComponent(typeof(RosConnector))]
  9. public abstract class UnityServiceSubscriber<Tout, Tin> : MonoBehaviour where Tout : Message where Tin : Message
  10. {
  11. protected void Start(string ServiceName, Tout serviceArguments)
  12. {
  13. GetComponent<RosConnector>().RosSocket.CallService<Tout, Tin>(ServiceName, ServiceResponseHandler, serviceArguments);
  14. }
  15. protected abstract void ServiceResponseHandler(Tin message);
  16. }
  17. }