def readConfig(self):
        parameters_to_send = {}

        parameters_to_send["0"] = {
            "parameter": "outstr-path",
            "value": self.output_stream,
            "comment": self.formCommentString(reach_tools.getAvailableSerialPorts()),
            "description": "Output path for corrections"
        }

        parameters_to_send["1"] = {"parameter": "rtcm3_out_messages", "value": ",".join(self.rtcm3_messages), "description": "RTCM3 messages for output"}

        # if we don't have a set base position we want to send empty strings
        if not self.base_position:
            base_pos = ["", "", ""]
        else:
            base_pos = self.base_position

        parameters_to_send["2"] = {"parameter": "base_pos_lat", "value": base_pos[0], "description": "Base latitude"}
        parameters_to_send["3"] = {"parameter": "base_pos_lon", "value": base_pos[1], "description": "Base longitude"}
        parameters_to_send["4"] = {"parameter": "base_pos_height", "value": base_pos[2], "description": "Base height"}

        parameters_to_send["5"] = {
                "parameter": "gps_cmd_file",
                "value": self.gps_cmd_file,
                "description": "Receiver configuration file",
                "comment": self.formCommentString(self.getAvailableReceiverCommandFiles())
        }

        print("DEBUG read")
        print(parameters_to_send)

        return parameters_to_send
Beispiel #2
0
    def readConfig(self):
        parameters_to_send = {}

        parameters_to_send["0"] = {
            "parameter": "outstr-path",
            "value": self.output_stream,
            "comment": self.formCommentString(reach_tools.getAvailableSerialPorts()),
            "description": "Output path for corrections"
        }

        parameters_to_send["1"] = {"parameter": "rtcm3_out_messages", "value": ",".join(self.rtcm3_messages), "description": "RTCM3 messages for output"}

        # if we don't have a set base position we want to send empty strings
        if not self.base_position:
            base_pos = ["", "", ""]
        else:
            base_pos = self.base_position

        parameters_to_send["2"] = {"parameter": "base_pos_lat", "value": base_pos[0], "description": "Base latitude"}
        parameters_to_send["3"] = {"parameter": "base_pos_lon", "value": base_pos[1], "description": "Base longitude"}
        parameters_to_send["4"] = {"parameter": "base_pos_height", "value": base_pos[2], "description": "Base height"}

        parameters_to_send["5"] = {
                "parameter": "gps_cmd_file",
                "value": self.gps_cmd_file,
                "description": "Receiver configuration file",
                "comment": self.formCommentString(self.getAvailableReceiverCommandFiles())
        }

        print("DEBUG read")
        print(parameters_to_send)

        return parameters_to_send
Beispiel #3
0
    def extractItemFromString(self, string):
        # extract information from a config file line
        # return true, if the line

        # create an empty item
        item = {}

        # cut the line into pieces by spaces
        separated_lines = string.split()
        length = len(separated_lines)

        # first, check if this line is empty
        if length > 0:

            # second, check if it's fully commented
            if separated_lines[0][0] != "#":

                # extract the parameter and value
                item["parameter"] = separated_lines[0]
                item["value"] = separated_lines[1][1:]

                # check if we have more info, possibly useful comment
                if length > 3 and separated_lines[2] == "#":
                    item["comment"] = separated_lines[3]

                    # check if we have more info, possibly description
                    if length > 5 and separated_lines[4] == "##":
                        # in order to have a description with spaces, we take all what's left
                        # after the "##" symbols and create a single line out of it:
                        description = separated_lines[5:]
                        description = " ".join(description)
                        item["description"] = description

                # check if we have only a description, rather than a comment and description
                if length > 3 and separated_lines[2] == "##":
                    description = separated_lines[3:]
                    description = " ".join(description)
                    item["description"] = description

                # add information about available serial connections to input and output paths
                if "path" in item["parameter"]:
                    item["comment"] = self.formSelectCommentFromList(
                        reach_tools.getAvailableSerialPorts())

        # we return the item we managed to extract form from string. if it's empty,
        # then we could not parse the string, hence it's empty, commented, or invalid
        return item
Beispiel #4
0
    def extractItemFromString(self, string):
        # extract information from a config file line
        # return true, if the line

        # create an empty item
        item = {}

        # cut the line into pieces by spaces
        separated_lines = string.split()
        length = len(separated_lines)

        # first, check if this line is empty
        if length > 0:

            # second, check if it's fully commented
            if separated_lines[0][0] != "#":

                # extract the parameter and value
                item["parameter"] = separated_lines[0]
                item["value"] = separated_lines[1][1:]

                # check if we have more info, possibly useful comment
                if length > 3 and separated_lines[2] == "#":
                    item["comment"] = separated_lines[3]

                    # check if we have more info, possibly description
                    if length > 5 and separated_lines[4] == "##":
                        # in order to have a description with spaces, we take all what's left
                        # after the "##" symbols and create a single line out of it:
                        description = separated_lines[5:]
                        description = " ".join(description)
                        item["description"] = description

                # check if we have only a description, rather than a comment and description
                if length >3 and separated_lines[2] == "##":
                    description = separated_lines[3:]
                    description = " ".join(description)
                    item["description"] = description

                # add information about available serial connections to input and output paths
                if "path" in item["parameter"]:
                    item["comment"] = self.formSelectCommentFromList(reach_tools.getAvailableSerialPorts())

        # we return the item we managed to extract form from string. if it's empty,
        # then we could not parse the string, hence it's empty, commented, or invalid
        return item