コード例 #1
0
 public void Release()
 {
     if (instance != null)
     {
         GalileoFunctions.ReleaseInstance(instance);
     }
 }
コード例 #2
0
 public void Dispose()
 {
     if (instance != null)
     {
         GalileoFunctions.Dispose(instance);
     }
 }
コード例 #3
0
        public GALILEO_RETURN_CODE ConnectIOT(string targetID, int timeout, string password, Action <GALILEO_RETURN_CODE, String> onConnect = null, Action <GALILEO_RETURN_CODE, String> onDisconnect = null)
        {
            byte[]               targetIDBytes  = Encoding.ASCII.GetBytes(targetID);
            byte[]               passwordBytes  = Encoding.ASCII.GetBytes(password);
            OnConnectDelegate    onConnectCB    = null;
            OnDisconnectDelegate onDisconnectCB = null;

            if (onConnect != null)
            {
                onConnectCB = (status, id, length) =>
                {
                    byte[] result = new byte[length];
                    Marshal.Copy(id, result, 0, (int)length);
                    onConnect?.Invoke(status, Encoding.ASCII.GetString(result, 0, (int)length));
                };
            }
            if (onDisconnect != null)
            {
                onDisconnectCB = (status, id, length) =>
                {
                    byte[] result = new byte[length];
                    Marshal.Copy(id, result, 0, (int)length);
                    onDisconnect?.Invoke(status, Encoding.ASCII.GetString(result, 0, (int)length));
                };
            }
            return(GalileoFunctions.ConnectIOT(instance, targetIDBytes, targetIDBytes.Length, timeout, passwordBytes, passwordBytes.Length, onConnectCB, onDisconnectCB));
        }
コード例 #4
0
 public void SetCurrentStatusCallback(Action <GalileoStatus> statusCB = null)
 {
     onStatusUpdateCB = (status, statusJson, length) => {
         byte[] result = new byte[length];
         Marshal.Copy(statusJson, result, 0, (int)length);
         var statusStr = Encoding.ASCII.GetString(result, 0, (int)length);
         statusCB?.Invoke(JsonConvert.DeserializeObject <GalileoStatus>(statusStr));
     };
     GalileoFunctions.SetCurrentStatusCallback(instance, onStatusUpdateCB);
 }
コード例 #5
0
 public void SetGoalReachedCallback(Action <int, GalileoStatus> goalCB)
 {
     onGoalReachedCB = (goalid, statusJson, length) => {
         byte[] result = new byte[length];
         Marshal.Copy(statusJson, result, 0, (int)length);
         var statusStr = Encoding.ASCII.GetString(result, 0, (int)length);
         goalCB?.Invoke(goalid, JsonConvert.DeserializeObject <GalileoStatus>(statusStr));
     };
     GalileoFunctions.SetGoalReachedCallback(instance, onGoalReachedCB);
 }
コード例 #6
0
        public ServerInfo GetCurrentServer()
        {
            byte[] currentServer = new byte[1024 * 1024];
            long   length        = 0;

            GalileoFunctions.GetCurrentServer(instance, currentServer, ref length);
            string currentServerJsonString = Encoding.UTF8.GetString(currentServer, 0, (int)length);

            return(JsonConvert.DeserializeObject <ServerInfo>(currentServerJsonString));
        }
コード例 #7
0
        public GalileoStatus GetCurrentStatus()
        {
            byte[] currentStatus = new byte[1024 * 1024];
            long   length        = 0;

            if (GalileoFunctions.GetCurrentStatus(instance, currentStatus, ref length) != GALILEO_RETURN_CODE.OK)
            {
                return(null);
            }
            string currentStatusJsonString = Encoding.UTF8.GetString(currentStatus, 0, (int)length);

            return(JsonConvert.DeserializeObject <GalileoStatus>(currentStatusJsonString));
        }
コード例 #8
0
        public List <ServerInfo> GetServersOnline()
        {
            byte[] servers = new byte[1024 * 1024];
            long   length  = 0;

            GalileoFunctions.GetServersOnline(instance, servers, ref length);
            string serversJsonString = Encoding.UTF8.GetString(servers, 0, (int)length);

            if (serversJsonString == "null")
            {
                return(new List <ServerInfo>());
            }
            JArray            serversJson = JArray.Parse(serversJsonString);
            List <ServerInfo> serversObj  = new List <ServerInfo>();;

            foreach (var server in serversJson)
            {
                serversObj.Add(server.ToObject <ServerInfo>());
            }
            return(serversObj);
        }
コード例 #9
0
        public GALILEO_RETURN_CODE SendGalileoBridgeRequest(string method, string url, string body, ref HttpBridgeResponse response, int timeout = 10 * 1000)
        {
            var methodBytes = Encoding.UTF8.GetBytes(method);
            var urlBytes    = Encoding.UTF8.GetBytes(url);
            var bodyBytes   = Encoding.UTF8.GetBytes(body);

            byte[] responseBytes = new byte[1024 * 1024];
            long   length        = 0;
            var    status        = GalileoFunctions.SendGalileoBridgeRequest(instance, methodBytes, methodBytes.Length,
                                                                             urlBytes, urlBytes.Length,
                                                                             bodyBytes, bodyBytes.Length,
                                                                             responseBytes, ref length, timeout);

            if (status != GALILEO_RETURN_CODE.OK)
            {
                return(status);
            }
            string responseStr = Encoding.UTF8.GetString(responseBytes, 0, (int)length);

            response = JsonConvert.DeserializeObject <HttpBridgeResponse>(responseStr);
            return(status);
        }
コード例 #10
0
 public GALILEO_RETURN_CODE Connect(String targetID, bool autoConnect, int timeout, Action <GALILEO_RETURN_CODE, String> onConnect = null, Action <GALILEO_RETURN_CODE, String> onDisconnect = null)
 {
     byte[] targetIDBytes = Encoding.ASCII.GetBytes(targetID);
     if (onConnect != null)
     {
         onConnectCB = (status, id, length) =>
         {
             byte[] result = new byte[length];
             Marshal.Copy(id, result, 0, (int)length);
             onConnect?.Invoke(status, Encoding.ASCII.GetString(result, 0, (int)length));
         };
     }
     if (onDisconnect != null)
     {
         onDisconnectCB = (status, id, length) =>
         {
             byte[] result = new byte[length];
             Marshal.Copy(id, result, 0, (int)length);
             onDisconnect?.Invoke(status, Encoding.ASCII.GetString(result, 0, (int)length));
         };
     }
     return(GalileoFunctions.Connect(instance, Encoding.ASCII.GetBytes(targetID), targetIDBytes.Length, autoConnect, timeout, onConnectCB, onDisconnectCB));
 }
コード例 #11
0
 public GALILEO_RETURN_CODE StartLoop()
 {
     return(GalileoFunctions.StartLoop(instance));
 }
コード例 #12
0
        public GALILEO_RETURN_CODE CheckServerOnline(string targetID)
        {
            var targetIDBytes = Encoding.UTF8.GetBytes(targetID);

            return(GalileoFunctions.CheckServerOnline(instance, targetIDBytes, targetIDBytes.Length));
        }
コード例 #13
0
 public bool IsConnecting()
 {
     return(GalileoFunctions.IsConnecting(instance));
 }
コード例 #14
0
 public GALILEO_RETURN_CODE SendRawAudio(byte[] data)
 {
     return(GalileoFunctions.SendRawAudio(instance, data, data.Length));
 }
コード例 #15
0
 public GALILEO_RETURN_CODE EnableGreeting(bool flag)
 {
     return(GalileoFunctions.EnableGreeting(instance, flag));
 }
コード例 #16
0
 public GALILEO_RETURN_CODE StartChargeLocal()
 {
     return(GalileoFunctions.StartChargeLocal(instance));
 }
コード例 #17
0
        public GALILEO_RETURN_CODE SendAudio(string audio)
        {
            var audioBytes = Encoding.UTF8.GetBytes(audio);

            return(GalileoFunctions.SendAudio(instance, audioBytes, audioBytes.Length));
        }
コード例 #18
0
 public GALILEO_RETURN_CODE Shutdown()
 {
     return(GalileoFunctions.Shutdown(instance));
 }
コード例 #19
0
 public GALILEO_RETURN_CODE SetSpeed(float vLinear, float xAngle)
 {
     return(GalileoFunctions.SetSpeed(instance, vLinear, xAngle));
 }
コード例 #20
0
 public GALILEO_RETURN_CODE StopMapping()
 {
     return(GalileoFunctions.StopMapping(instance));
 }
コード例 #21
0
 public GALILEO_RETURN_CODE SetLoopWaitTime(byte time)
 {
     return(GalileoFunctions.SetLoopWaitTime(instance, time));
 }
コード例 #22
0
 public GALILEO_RETURN_CODE GetGoalNum(ref byte goalNum)
 {
     return(GalileoFunctions.GetGoalNum(instance, ref goalNum));
 }
コード例 #23
0
 public GALILEO_RETURN_CODE MoveTo(float x, float y, ref byte goalNum)
 {
     return(GalileoFunctions.MoveTo(instance, x, y, ref goalNum));
 }
コード例 #24
0
 public GALILEO_RETURN_CODE StopCharge()
 {
     return(GalileoFunctions.StopCharge(instance));
 }
コード例 #25
0
 public GALILEO_RETURN_CODE StartCharge(float x, float y)
 {
     return(GalileoFunctions.StartCharge(instance, x, y));
 }
コード例 #26
0
 public GALILEO_RETURN_CODE SaveChargeBasePosition()
 {
     return(GalileoFunctions.SaveChargeBasePosition(instance));
 }
コード例 #27
0
 public GALILEO_RETURN_CODE SetAngle(byte sign, byte angle)
 {
     return(GalileoFunctions.SetAngle(instance, sign, angle));
 }
コード例 #28
0
 public void WaitForGoal(byte goalIndex)
 {
     GalileoFunctions.WaitForGoal(instance, goalIndex);
 }
コード例 #29
0
 public void Disconnect()
 {
     GalileoFunctions.Disconnect(instance);
 }
コード例 #30
0
 public GALILEO_RETURN_CODE UpdateMap()
 {
     return(GalileoFunctions.UpdateMap(instance));
 }