﻿using UnityEngine;
using SocketIOClient;

public class ServoControllerClient : AbstractSocketioClient {
	private static readonly string SOCKETIO_SERVER = "http://192.168.1.51:5000";
	private static readonly string SOCKETIO_NAMESPACE = "/servo";

	public ServoControllerClient()
		: base(SOCKETIO_SERVER, SOCKETIO_NAMESPACE){}

	/* -------------------- */
	/* - Eventemitter     - */
	/* -------------------- */
	public void EventSetServoPosition(long position) {
		this.Emit("moveTo", position);
	}

	public void EventStop() {
		this.Emit("stop");
	}

	public void PullToLeft() {
	    this.Emit("pullToLeft");
	}

	public void PullToRight() {
	    this.Emit("pullToRight");
	}
}

﻿using UnityEngine;
using SocketIOClient;

public class ServoControllerClient : AbstractSocketioClient {
	private static readonly string SOCKETIO_SERVER = "http://192.168.1.51:5000";
	private static readonly string SOCKETIO_NAMESPACE = "/servo";

	public ServoControllerClient()
		: base(SOCKETIO_SERVER, SOCKETIO_NAMESPACE){}

	/* -------------------- */
	/* - Eventemitter     - */
	/* -------------------- */
	public void EventSetServoPosition(long position) {
		Debug.LogWarning("Set servo to: " + position);
		this.Emit("moveTo", position);
	}

	public void EventStop() {
		this.Emit("stop");
	}

	public void EventEnable() {
		this.Emit("enable");
	}

	public void PullToLeft() {
	    this.Emit("pullToLeft");
	}

	public void PullToRight() {
	    this.Emit("pullToRight");
	}
}

Implement "enable" event to reenable after "stop".
[Unity] Implement "enable" event to reenable after "stop".

Signed-off-by: Juri Berlanda <5bfdca9e82c53adb0603ce7083f4ba4f2da5cacf@hotmail.com>
