Exemple #1
0
        public static void HandShake()
        {
            var r = new HandShake();

            string message = JObject.FromObject(r).ToString();

            RNBridge.SendMessage(message);
        }
Exemple #2
0
        public static void SendCommandToReceiver(string message)
        {
            if (RNBridge.commandsReceiver == null)
            {
                return;
            }

            RNBridge.commandsReceiver.HandleCommand(RNBridge.CreateCommand(message));
        }
Exemple #3
0
 private void SendResult(object resultData = null)
 {
     if (!completed)
     {
         completed = true;
         RNCommandResult data   = new RNCommandResult(id, resolved, resultData);
         RNMessageResult result = new RNMessageResult(name, data);
         RNBridge.SendResult(result);
     }
 }
Exemple #4
0
        public static void SendEvent(String name, object data = null)
        {
            EventResult r = new EventResult();

            r.name = name;
            r.data = data;

            string message = JObject.FromObject(r).ToString();

            RNBridge.SendMessage(message);
        }
Exemple #5
0
        private void SendResult(object resultData = null)
        {
            if (!this.completed)
            {
                this.completed = true;
                if (resultData == null)
                {
                    resultData = new { };
                }

                RNBridge.SendResult(id, name, resolved, resultData);
            }
        }
Exemple #6
0
        public static void SendResult(int id, String name, bool resolved, object data)
        {
            CommandResult r = new CommandResult();

            r.id       = id;
            r.name     = name;
            r.resolved = resolved;
            r.data     = data;

            string message = JObject.FromObject(r).ToString();

            RNBridge.SendMessage(message);
        }
Exemple #7
0
 private static void ReceiveHandshake()
 {
     System.Threading.Tasks.Task.Factory.StartNew(() =>
     {
         if (commandsReceivers != null)
         {
             if (Debug.isDebugBuild)
             {
                 Debug.Log($"{nameof(RNBridge)}: receive handshake");
             }
             RNBridge.SendHandshake(new RNMessageHandshake());
         }
     },
                                                  System.Threading.CancellationToken.None,
                                                  System.Threading.Tasks.TaskCreationOptions.None,
                                                  unityScheduler);
 }
 public void HandleCommand(string message)
 {
     RNBridge.SendCommandToReceiver(message);
 }
 public void HandShake()
 {
     RNBridge.HandShake();
 }