Skip to content

Auto discovery feature #4

@hllhll

Description

@hllhll

com.airconet.plus.info.activity.AddDeviceActivity.lambda$search$1$AddDeviceActivity Sends b'cast to 255.255.255.255:1025 with "Are You AirM2M IOT Smart Device?"

lambda$search$2$AddDeviceActivity Listens on the same socket and recives back some data that is later parsed as AirConDevice

    public static final Pattern SEARCH_PATTERN = Pattern.compile("^I'm\\s*(\\w+)\\.\\s*((\\p{XDigit}{2}:?){5}\\p{XDigit}{2})\\s*((\\d{1,3}\\.){3}\\d{1,3})")
    ...
    private AirConDevice parse(String str) {
        Matcher matcher = SEARCH_PATTERN.matcher(str);
        if (!matcher.find()) {
            return null;
        }
        String group = matcher.group(1);  // Type?
        String group2 = matcher.group(2);   // Mac address
        String group3 = matcher.group(4);   // Private ip
        if (group2 != null) {
            return AirConDevice.create(group, group2.replaceAll(":", "").toUpperCase(), group3);
        }
        return null;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions