Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Ondrej Tomcik
    @ondrejtomcik
    It's not only about setting coapcloudconf resource. It's also about having right certificates, but if you're using SDK in a same way as we do in the plgd.mobile, it should work. And setting ACLs.
    Yorick Coleu
    @YorickColeu
    Hi Ondrej, thanks for your response. I use devices that don't have Google Play Store, so I tried to retrieved the APK using APKPure application. I successfully retrieved the plgd.dev app with the following version: Nov 25 2020, version: 1.0.1 (6).
    Ondrej Tomcik
    @ondrejtomcik
    Ok, and this one is not working?
    Yorick Coleu
    @YorickColeu
    Actually using that version, It's worse. When I press the "Continue with Google button", I get the following error:
    ```
    03-22 13:13:07.313 6560 6578 E flutter : [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: Null check operator used on a null value
    03-22 13:13:07.313 6560 6578 E flutter : #0 _AndroidMotionEventConverter.toAndroidMotionEvent.<anonymous closure> (package:flutter/src/services/platform_views.dart:601)
    03-22 13:13:07.313 6560 6578 E flutter : #1 MappedListIterable.elementAt (dart:_internal/iterable.dart:417)
    03-22 13:13:07.313 6560 6578 E flutter : #2 ListIterator.moveNext (dart:_internal/iterable.dart:343)
    03-22 13:13:07.313 6560 6578 E flutter : #3 new List.from (dart:core-patch/array_patch.dart:38)
    03-22 13:13:07.313 6560 6578 E flutter : #4 new List.of (dart:core-patch/array_patch.dart:68)
    03-22 13:13:07.313 6560 6578 E flutter : #5 ListIterable.toList (dart:_internal/iterable.dart:102)
    03-22 13:13:07.313 6560 6578 E flutter : #6 _AndroidMotionEventConverter.toAndroidMotionEvent (package:flutter/src/services/platform_views.dart:602)
    03-22 13:13:07.313 6560 6578 E flutter : #7 AndroidViewController.dispatchPointerEvent (package:flutter/src/services/platform_views.dart:864)
    03-22 13:13:07.313 6560 6578 E flutter : #8 _GrowableList.forEach (dart:core-patch/growable_array.dart:313)
    03-22 13:13:07.313 6560 6578 E flutter : #9 _PlatformViewGestureRecognizer._flushPointerCache (package:flutter/src/rendering/platform_view.dart:560)
    03-22 13:13:07.313 6560 6578 E flutter : #10 _PlatformViewGestureRecognizer.acceptGesture (package:flutter/src/rendering/platform_view.dart:542)
    03-22 13:13:07.313 6560 6578 E flutter : #11 _CombiningGestureArenaMember.acceptGesture (package:flutter/src/gestures/team.dart:42)
    03-22 13:13:07.313 6560 6578 E flutter : #12 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:157)
    03-22 13:13:07.313 6560 6578 E flutter : #13 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:362)
    03-22 13:13:07.313 6560 6578 E flutter : #14 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:338)
    03-22 13:13:07.313 6560 6578 E flutter : #15 RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:267)
    03-22 13:13:07.313 6560 6578 E flutter : #16 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:295)
    03-22 13:13:07.313 6560 6578 E flutter : #17 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:240)
    03-22 13:13:07.313 6
    The rest of error:
    03-22 13:13:07.313 6560 6578 E flutter : #18 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:213)
    03-22 13:13:07.313 6560 6578 E flutter : #19 _rootRunUnary (dart:async/zone.dart:1206)
    03-22 13:13:07.313 6560 6578 E flutter : #20 _CustomZone.runUnary (dart:async/zone.dart:1100)
    03-22 13:13:07.313 6560 6578 E flutter : #21 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1005)
    03-22 13:13:07.313 6560 6578 E flutter : #22 _invoke1 (dart:ui/hooks.dart:265)
    03-22 13:13:07.313 6560 6578 E flutter : #23 _dispatchPointerDataPacket (dart:ui/hooks.dart:174)
    Ondrej Tomcik
    @ondrejtomcik
    Easiest is to use just go client from the plgd.mobile repository and do it from the console. OR buy cheapest Samsung phone :)
    Wouter
    @WAvdBeek
    if I need another certificate, how to obtain that?
    I am setting the ACL to configure the coap cloud config, and that works..
    so what kind of info that is not being set by coapcloudconfig is needed to talk to the plgd bundle?
    Jozef Kralik
    @jkralik
    @WAvdBeek There are 3 ways how to obtain RootCA certificate:
    • via file : docker exec -it cloud cat /data/certs/root_ca.crt > pki_certs/cloudca.pem
    • via web: GET https://${FQDN}:${NGINX_PORT}/.well-known/ocfcloud-configuration and it stored under property: cloud_certificate_authorities. eg https://try.plgd.cloud/.well-known/ocfcloud-configuration
    • via tls connection: openssl s_cllient -connect ${FQDN}:5684 -showcerts and the last certificate of chain is RootCA of cloud
    Wouter
    @WAvdBeek
    thanks!, how do I get that pem file into my code without compiling?
    Jozef Kralik
    @jkralik
    @WAvdBeek if you have stored it (eg option 1) you can read it from the file. This is the simplest way.
    Wouter
    @WAvdBeek
    @jkralik can you give me the steps in how the plgd app is configuring the device talking to the cloud?
    Jozef Kralik
    @jkralik

    @WAvdBeek at the start plgd.app (first page) you can select domain of cloud where you want to onboard the device (eg try.plgd.cloud / bundle FQDN). After that app download https://DOMAIN/.well-known/ocfcloud-configuration and this configuration is used during onboard the device to the cloud.
    The process of onboard the device the cloud:

    1. own the device (https://github.com/plgd-dev/plgd.mobile/blob/master/ocfclient/OCFClient.go#L107)
    2. move to provision mode (https://github.com/plgd-dev/plgd.mobile/blob/master/ocfclient/OCFClient.go#L124)
    3. set ACLs for access from cloud (https://github.com/plgd-dev/plgd.mobile/blob/master/ocfclient/OCFClient.go#L149)
    4. set RootCA for communication with cloud (https://github.com/plgd-dev/plgd.mobile/blob/master/ocfclient/OCFClient.go#L158)
    5. move to normal mode(https://github.com/plgd-dev/plgd.mobile/blob/master/ocfclient/OCFClient.go#L128)
    6. onboard device to the cloud https://github.com/plgd-dev/plgd.mobile/blob/master/ocfclient/OCFClient.go#L168 - (move to provision mode, set cloud resource, move to normal mode)

    that's all I think

    Yorick Coleu
    @YorickColeu

    Hello @ondrejtomcik , thanks for your response. Actually I had an InAppWebView error that I caught by implementing a onConsoleMessage callback like this:

    diff --git a/lib/components/oauthHandler.dart b/lib/components/oauthHandler.dart
    index 1093d76..bb2596e 100644
    --- a/lib/components/oauthHandler.dart
    +++ b/lib/components/oauthHandler.dart
    @@ -4,6 +4,7 @@ import 'package:flutter/gestures.dart';
     import 'package:flutter/material.dart';
     import 'package:flutter_spinkit/flutter_spinkit.dart';
     import 'package:flutter_inappwebview/flutter_inappwebview.dart';
    +import 'package:flutter/foundation.dart';
    
     class OAuthHandler extends StatefulWidget {
       final String authUrl;
    @@ -67,6 +68,10 @@ class _OAuthHandlerState extends State<OAuthHandler> {
                       });
    
                     },
    +                onConsoleMessage: (InAppWebViewController controller, ConsoleMessage consoleMessage) {
    +                  debugPrint('consoleMessage: $consoleMessage');
    +                  return;
    +                },
                     onLoadError: (InAppWebViewController controller, String url, int code, String message) {
                       if (code == 102) { // apple signin returns 102 what is not an error
                         return;

    I caught the following error: "window.flutter_inappwebview.callHandler is not a function". I fixed this with a workaround found at: pichillilorenzo/flutter_inappwebview#218.

    According to the flutter_inappwebview release note (https://pub.flutter-io.cn/packages/flutter_inappwebview/changelog), this should have been fixed in flutter_inappwebview v5.0.0.

    I tried to upgrade to flutter_inappwebview v5.0.0 but it breaks a lot of things.

    Ondrej Tomcik
    @ondrejtomcik
    @YorickColeu thank you for your feedback and investigation!!! I am unfortunatelly fully booked. Would you be willing to update plgd.mobile to the newest flutter_inappwebview and contribute it to our repo? :)
    David Márquez Fàbrega
    @DavidMarquezF
    Is it normal that I'm getting get requests every second on my device if it's connected to the cloud ( and I haven't enabled notifications)? Or I'm doing something wrong? (I'm using try.plgd.cloud) Thanks in advance!
    Ondrej Tomcik
    @ondrejtomcik
    To which resource @DavidMarquezF ?
    David Márquez Fàbrega
    @DavidMarquezF
    All the resources I have (binary switch, sensor measurement and temperature
    David Márquez Fàbrega
    @DavidMarquezF
    Well actually a custom resource I have with a oic.if.r interface doesn't, but all the others mentioned above do
    Ondrej Tomcik
    @ondrejtomcik
    @DavidMarquezF such a feature doesn't exist and we are also not aware of such a behavior. And no, it's not normal to receive GET request every second on your device. Do you have in your setup only plgd cloud bundle and your device? Nothing else?
    Jozef Kralik
    @jkralik
    @DavidMarquezF Could you send us data/logs/coap-gateway.log, /data/logs/coap-gateway-unsecure.log from docker container ?
    David Márquez Fàbrega
    @DavidMarquezF
    I wasn't running docker, I was using the try.plgd.cloud/ one. I will try to set it up with docker and give you an update if I find anything. Thanks!
    Ondrej Tomcik
    @ondrejtomcik
    @DavidMarquezF no need to reproduce is locally. Just connect your device to try.plgd.cloud and write us, we will check our logs in monitoring system.
    David Márquez Fàbrega
    @DavidMarquezF
    Okay i connected now (
    Jozef Kralik
    @jkralik
    @DavidMarquezF And what is your deviceID ? This can helps us to filter logs...
    Jozef Kralik
    @jkralik
    @DavidMarquezF I'm seeing the device b4fead3a-72af-4043-56e8-90590de03c92 and I found that there was old coap-gw which had bug in keepalicve so i updated and it seems that closing connection doesn't appear any more.
    David Márquez Fàbrega
    @DavidMarquezF
    Sorry about that, yup it is b4fead3a-72af-4043-56e8-90590de03c92 indeed
    I tried again now and I still get calls every second in the get callback
    David Márquez Fàbrega
    @DavidMarquezF
    By the way, maybe it's unrelated, but should I develop my devices using the plgdev branch for iotivity-lite? I found that since I updated iotivity-lite with the lastest version in master the plgdev app stops discovering my device (I fixed it by just reverting the merge)
    Ondrej Tomcik
    @ondrejtomcik
    @DavidMarquezF yes, use plgd branch.
    There are some new breaking changes which we didn’t integrate yet to our sdk.
    David Márquez Fàbrega
    @DavidMarquezF
    okay, thanks!
    Jozef Kralik
    @jkralik
    @DavidMarquezF From logs I see that the device b4fead3a-72af-4043-56e8-90590de03c92 doesn't send response for the PING requests. So cloud close connection. After that device reconnects again to the cloud and then cloud start obsere all resources of the device. This is why you see lot's of GET requests.
    David Márquez Fàbrega
    @DavidMarquezF
    Thanks for the info! I'll use the plgd branch and see if it still happens. If it still does I'll try to investigate further what's happening
    David Márquez Fàbrega
    @DavidMarquezF
    I digged a bit deeper into it (I'm still not done) but I wanted to share what i found. Apparently I don't get a call from the server each second, it's the device that has the internal periodic observation setup. When the device is initialized oc_ri_invoke_coap_entity_handler is called for each resource (as you pointed out). However, since these resources are set up as periodic observables (every second), iotivity polls internally every second the resources. These send their info to the cloud.
    I tried using wireshark to debug the connections (I set up a local docker as explained in https://plgd.dev/guide/getting-started/1-deploy.html#bundle) but I can't seem to make it decrypt the connection with the private key. However, I tried setting some debug points and it does look like it responds with a PONG.
    David Márquez Fàbrega
    @DavidMarquezF
    If I remove the periodic observation every second from the resources this won't happen. But then I'm curious as how you would be able to set a periodically observable resource in the cloud conditionally (let the user decide if the resource should be updated every second or not), with the notification switch in the web UI for example.
    Jozef Kralik
    @jkralik
    @DavidMarquezF For cloud it is expected that all resources are observable. It means when any change occurs on any property of any resource, devices sends a notification to the cloud with that resource. You can trigger it via oc_notify_observers(). Pulling mechanism is inefficiency so we don't want to support it.
    David Márquez Fàbrega
    @DavidMarquezF
    Okay, it makes sense, thank you @jkralik !
    Wouter
    @WAvdBeek
    Hi Ondrej, Jozef.
    Ondrej Tomcik
    @ondrejtomcik
    @WAvdBeek Hello
    Wouter
    @WAvdBeek
    I had to make a change to IoTivity, there was a compiling error, please take a look at iotivity/iotivity-lite#34 and make a better fix that actually compiles
    Ondrej Tomcik
    @ondrejtomcik
    Were you in hurry? Asking because I see it's already merged :)
    Wouter
    @WAvdBeek
    yeah, otgc is not building due to this issue.
    Wouter
    @WAvdBeek
    hmm, it looks like the fix is gone again, e.g. looking at master in github the change is not there anymore
    I have asked to shut down gitlab asap, because I think it is overwriting github.
    Ondrej Tomcik
    @ondrejtomcik
    Or if you have owner rights on gitlab, you can disable mirror
    nope, only Kishen, VTM and Rami