Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I add function for check wifi connect status of device #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

Ksanbal
Copy link

@Ksanbal Ksanbal commented May 20, 2021

Hello, I need to check wifi connect status for my Flutter project with your package.

So I add some code can use this function.

Android - java

// BlufiPlugin.java
@Override
public void onDeviceStatusResponse(BlufiClient client, int status, BlufiStatusResponse response) {
    if (status == STATUS_SUCCESS) {
    updateMessage(makeJson("device_status","1"));
//        updateMessage(String.format("Receive device status response:\n%s"));
     // Add code - check status connect wifi of device
      if (response.isStaConnectWifi()){   
          updateMessage(makeJson("device_wifi_connect","1"));
      } else {
          updateMessage(makeJson("device_wifi_connect","0"));
      }
    } else {
    updateMessage(makeJson("device_status","0"));
//        updateMessage("Device status response error, code=" + status);
    }
}

IOS - objc

// BlufiPlugin.m
- (void)blufi:(BlufiClient *)client didReceiveDeviceStatusResponse:(BlufiStatusResponse *)response status:(BlufiStatusCode)status {
   
    if (status == StatusSuccess) {
        [self updateMessage:[self makeJsonWithCommand:@"device_status" data:@"1"]];
        // Add code - check status connect wifi of device
        if ([response isStaConnectWiFi]) {
            [self updateMessage:[self makeJsonWithCommand:@"device_wifi_connect" data:@"1"]];
        } else {
            [self updateMessage:[self makeJsonWithCommand:@"device_wifi_connect" data:@"0"]];
        }
    } else {
        [self updateMessage:[self makeJsonWithCommand:@"device_status" data:@"0"]];
    }
}

Can you add this codes to package?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant