example.remote.interface.demo/src/terra/harvest/standalone/demo/RemoteInterfaceStandaloneDemo.java
public void runMissionProgrammingDemo() throws IOException
    {

        // ---------------------------------------------------------------------
        // GET STORED TEMPLATE NAMES
        // See what templates, if any, are on the destination controller
        // device. The response contains a list of known templates on the
        // controller device.
        // ---------------------------------------------------------------------
        // Construct the request
        MissionProgrammingNamespace.Builder getTemplateNamesBuilder = MissionProgrammingNamespace.newBuilder().setType(
                MissionProgrammingMessageType.GetTemplatesRequest);
        TerraHarvestMessage requestStoredTemplates = this.createTerraHarvestMsg(Namespace.MissionProgramming,
                getTemplateNamesBuilder);
        requestStoredTemplates.writeDelimitedTo(sock.getOutputStream());

        // Read in the response
        TerraHarvestMessage responseStoredTemplates = TerraHarvestMessage.parseDelimitedFrom(sock.getInputStream());
        TerraHarvestPayload payloadStoreTemplates = 
                TerraHarvestPayload.parseFrom(responseStoredTemplates.getTerraHarvestPayload());
        MissionProgrammingNamespace mpResponseMessage = 
                MissionProgrammingNamespace.parseFrom(payloadStoreTemplates.getNamespaceMessage());
        GetTemplatesResponseData templateNames = GetTemplatesResponseData.parseFrom(mpResponseMessage.getData());
        System.out.println(templateNames);

        // ---------------------------------------------------------------------
        // LOAD TEMPLATES
        // Missions can be instantiated by loading a template and providing a
        // set of parameters.
        // Multiple missions may be created from the same template.
        // Different instances might use different parameters; for example,
        // one mission may reference one asset, but another mission constructed
        // from the same template may reference a different asset (such as
        // 'left' and 'right' cameras).
        // ---------------------------------------------------------------------

        // Each template has a script. Scripts may contain variables that must be defined; see the script in the
        // template to determine what variables must be defined.
        // To define these variables, build a VariableMetaData instance.
        MissionProgramTemplateGen.MissionVariableMetaData varData = 
                MissionProgramTemplateGen.MissionVariableMetaData.newBuilder().
                setBase(VariableMetaData.newBuilder().
                    setName("variable").
                    setDescription("I describe a variable").
                    setDefaultValue("My Asset").
                    setHumanReadableName("The variable")).
                setType(MissionProgramTemplateGen.MissionVariableTypes.Enum.ASSET).
                build();
        // Build a mission from a template
        MissionProgramTemplateGen.MissionProgramTemplate template = 
                MissionProgramTemplateGen.MissionProgramTemplate.newBuilder().
                    setName("TEST_TEMPLATE").
                    setSource("If one wanted to change the script, this is where the change would be made").
                    setDescription("This describes the template").
                    addVariableMetaData(varData).build();
        // Build a template message
        LoadTemplateRequestData programMessage = MissionProgramMessages.LoadTemplateRequestData.newBuilder().setMission(
                template).build();

        // Construct and send the TerraHarvestMessage
        MissionProgrammingNamespace.Builder builderLoadTemplate = MissionProgrammingNamespace.newBuilder().
                setType(MissionProgrammingMessageType.LoadTemplateRequest).
                setData(programMessage.toByteString());
        TerraHarvestMessage messageLoadTemplate = this.createTerraHarvestMsg(Namespace.MissionProgramming,
                builderLoadTemplate);
        messageLoadTemplate.writeDelimitedTo(sock.getOutputStream());

        // The response should be a non-null message of namespace "Namespace.MissionProgramming".
        // The error code (like a status code) should be reported as "No error".
        TerraHarvestMessage responseLoadTemplate = TerraHarvestMessage.parseDelimitedFrom(sock.getInputStream());
        TerraHarvestPayload payloadForTemplate = 
                TerraHarvestPayload.parseFrom(responseLoadTemplate.getTerraHarvestPayload());

        System.out.println("The response is of namespace " + payloadForTemplate.getNamespace());

        // The type of the response message should be a "MissionProgrammingMessageType.LoadTemplateResponse".
        MissionProgrammingNamespace namespaceResponseLoadTemplate = 
                MissionProgrammingNamespace.parseFrom(payloadForTemplate.getNamespaceMessage());
        System.out.println("The response message type is " + namespaceResponseLoadTemplate.getType());

    }
/**
     * This demonstrates using templates with the mission programming namespace. Mission program management enables the
     * execution of scripts on controller software. Scripts can use or exploit assets, custom comms, or other
     * capabilities. Templates are pre-configured controller software configurations and scripts.
     */
This demonstrates using templates with the mission programming namespace. Mission program management enables the
execution of scripts on controller software. Scripts can use or exploit assets, custom comms, or other
capabilities. Templates are pre-configured controller software configurations and scripts.
This demonstrates using templates with the mission programming namespace . Mission program management enables the execution of scripts on controller software . Scripts can use or exploit assets custom comms or other capabilities . Templates are pre - configured controller software configurations and scripts .
public void runMissionProgrammingDemo() throws IOException
    {
        MissionProgrammingNamespace.Builder getTemplateNamesBuilder = MissionProgrammingNamespace.newBuilder().setType(
                MissionProgrammingMessageType.GetTemplatesRequest);
        TerraHarvestMessage requestStoredTemplates = this.createTerraHarvestMsg(Namespace.MissionProgramming,
                getTemplateNamesBuilder);
        requestStoredTemplates.writeDelimitedTo(sock.getOutputStream());
        TerraHarvestMessage responseStoredTemplates = TerraHarvestMessage.parseDelimitedFrom(sock.getInputStream());
        TerraHarvestPayload payloadStoreTemplates = 
                TerraHarvestPayload.parseFrom(responseStoredTemplates.getTerraHarvestPayload());
        MissionProgrammingNamespace mpResponseMessage = 
                MissionProgrammingNamespace.parseFrom(payloadStoreTemplates.getNamespaceMessage());
        GetTemplatesResponseData templateNames = GetTemplatesResponseData.parseFrom(mpResponseMessage.getData());
        System.out.println(templateNames);
        MissionProgramTemplateGen.MissionVariableMetaData varData = 
                MissionProgramTemplateGen.MissionVariableMetaData.newBuilder().
                setBase(VariableMetaData.newBuilder().
                    setName("variable").
                    setDescription("I describe a variable").
                    setDefaultValue("My Asset").
                    setHumanReadableName("The variable")).
                setType(MissionProgramTemplateGen.MissionVariableTypes.Enum.ASSET).
                build();
        MissionProgramTemplateGen.MissionProgramTemplate template = 
                MissionProgramTemplateGen.MissionProgramTemplate.newBuilder().
                    setName("TEST_TEMPLATE").
                    setSource("If one wanted to change the script, this is where the change would be made").
                    setDescription("This describes the template").
                    addVariableMetaData(varData).build();
        LoadTemplateRequestData programMessage = MissionProgramMessages.LoadTemplateRequestData.newBuilder().setMission(
                template).build();
        MissionProgrammingNamespace.Builder builderLoadTemplate = MissionProgrammingNamespace.newBuilder().
                setType(MissionProgrammingMessageType.LoadTemplateRequest).
                setData(programMessage.toByteString());
        TerraHarvestMessage messageLoadTemplate = this.createTerraHarvestMsg(Namespace.MissionProgramming,
                builderLoadTemplate);
        messageLoadTemplate.writeDelimitedTo(sock.getOutputStream());
        TerraHarvestMessage responseLoadTemplate = TerraHarvestMessage.parseDelimitedFrom(sock.getInputStream());
        TerraHarvestPayload payloadForTemplate = 
                TerraHarvestPayload.parseFrom(responseLoadTemplate.getTerraHarvestPayload());
        System.out.println("The response is of namespace " + payloadForTemplate.getNamespace());
        MissionProgrammingNamespace namespaceResponseLoadTemplate = 
                MissionProgrammingNamespace.parseFrom(payloadForTemplate.getNamespaceMessage());
        System.out.println("The response message type is " + namespaceResponseLoadTemplate.getType());
    }
public void runMissionProgrammingDemo ( ) throws IOException { MissionProgrammingNamespace . Builder getTemplateNamesBuilder = MissionProgrammingNamespace . newBuilder ( ) . setType ( MissionProgrammingMessageType . GetTemplatesRequest ) ; TerraHarvestMessage requestStoredTemplates = this . createTerraHarvestMsg ( Namespace . MissionProgramming , getTemplateNamesBuilder ) ; requestStoredTemplates . writeDelimitedTo ( sock . getOutputStream ( ) ) ; TerraHarvestMessage responseStoredTemplates = TerraHarvestMessage . parseDelimitedFrom ( sock . getInputStream ( ) ) ; TerraHarvestPayload payloadStoreTemplates = TerraHarvestPayload . parseFrom ( responseStoredTemplates . getTerraHarvestPayload ( ) ) ; MissionProgrammingNamespace mpResponseMessage = MissionProgrammingNamespace . parseFrom ( payloadStoreTemplates . getNamespaceMessage ( ) ) ; GetTemplatesResponseData templateNames = GetTemplatesResponseData . parseFrom ( mpResponseMessage . getData ( ) ) ; System . out . println ( templateNames ) ; MissionProgramTemplateGen . MissionVariableMetaData varData = MissionProgramTemplateGen . MissionVariableMetaData . newBuilder ( ) . setBase ( VariableMetaData . newBuilder ( ) . setName ( "variable" ) . setDescription ( "I describe a variable" ) . setDefaultValue ( "My Asset" ) . setHumanReadableName ( "The variable" ) ) . setType ( MissionProgramTemplateGen . MissionVariableTypes . Enum . ASSET ) . build ( ) ; MissionProgramTemplateGen . MissionProgramTemplate template = MissionProgramTemplateGen . MissionProgramTemplate . newBuilder ( ) . setName ( "TEST_TEMPLATE" ) . setSource ( "If one wanted to change the script, this is where the change would be made" ) . setDescription ( "This describes the template" ) . addVariableMetaData ( varData ) . build ( ) ; LoadTemplateRequestData programMessage = MissionProgramMessages . LoadTemplateRequestData . newBuilder ( ) . setMission ( template ) . build ( ) ; MissionProgrammingNamespace . Builder builderLoadTemplate = MissionProgrammingNamespace . newBuilder ( ) . setType ( MissionProgrammingMessageType . LoadTemplateRequest ) . setData ( programMessage . toByteString ( ) ) ; TerraHarvestMessage messageLoadTemplate = this . createTerraHarvestMsg ( Namespace . MissionProgramming , builderLoadTemplate ) ; messageLoadTemplate . writeDelimitedTo ( sock . getOutputStream ( ) ) ; TerraHarvestMessage responseLoadTemplate = TerraHarvestMessage . parseDelimitedFrom ( sock . getInputStream ( ) ) ; TerraHarvestPayload payloadForTemplate = TerraHarvestPayload . parseFrom ( responseLoadTemplate . getTerraHarvestPayload ( ) ) ; System . out . println ( "The response is of namespace " + payloadForTemplate . getNamespace ( ) ) ; MissionProgrammingNamespace namespaceResponseLoadTemplate = MissionProgrammingNamespace . parseFrom ( payloadForTemplate . getNamespaceMessage ( ) ) ; System . out . println ( "The response message type is " + namespaceResponseLoadTemplate . getType ( ) ) ; }
This demonstrates using templates with the mission programming namespace.
This demonstrates using templates with the mission programming namespace .
// --------------------------------------------------------------------- // GET STORED TEMPLATE NAMES // See what templates, if any, are on the destination controller // device. The response contains a list of known templates on the // controller device. // --------------------------------------------------------------------- // Construct the request // Read in the response // --------------------------------------------------------------------- // LOAD TEMPLATES // Missions can be instantiated by loading a template and providing a // set of parameters. // Multiple missions may be created from the same template. // Different instances might use different parameters; for example, // one mission may reference one asset, but another mission constructed // from the same template may reference a different asset (such as // 'left' and 'right' cameras). // --------------------------------------------------------------------- // Each template has a script. Scripts may contain variables that must be defined; see the script in the // template to determine what variables must be defined. // To define these variables, build a VariableMetaData instance. // Build a mission from a template // Build a template message // Construct and send the TerraHarvestMessage // The response should be a non-null message of namespace "Namespace.MissionProgramming". // The error code (like a status code) should be reported as "No error". // The type of the response message should be a "MissionProgrammingMessageType.LoadTemplateResponse".