public static void Start() { if (!_instance.alreadyStarted) { _instance.alreadyStarted = true; ForceSocket.Start(); _instance.uuid = ForceSocket.IssuePerodicResponseCommand(ForceSocket.KnownCommands.StartCOP, new { UseCOG = false, Rate = 1000.0f / 30.0f },// 30 data frames per second _instance._OnData, typeof(COPData)); } }
/// <summary> /// Issues a command with a periodic completion callback that takes a specific data type. /// </summary> /// <param name="command">the protocol-specific command to issue</param> /// <param name="parms">parms for the command</param> /// <param name="completionCallback">The method that should be invoked when the server returns back a result. The method will be called /// with the raw JSON string and object of the given dataType parsed from the JSON string.</param> /// <param name="datatype">The Type that the JSON parser should convert the incoming result data into. This new data object will be passed /// in the completionCallback's object parm</param> /// <returns>The UUID that was assigned to this command. Can be used for internal bookkeeping or for later use by RemoveCallback.</returns> public string StartListener(string command, object parms, Action <string, object> completionCallback, Type datatype) { ForceSocket.Start(); return(ForceSocket.IssuePerodicResponseCommand(ForceSocket.KnownCommands.ProtocolCommand, concatCommandToParms(command, parms), completionCallback, datatype)); }