flutter blue 라이브러리의 release 모드에서 작동 문제

Flutter blue 라이브러리의 블루투스 연결감지 등 기능이 release 버전의 안드로이드 앱에서 작동이가 안되는 문제가 발견. debug 모드에서는 정상 작동.  

다음 문서를 참고하여 해결 

https://github.com/pauldemarco/flutter_blue/issues/772

구체적으로는, 

android/app/build.gradle 의 buildTypes에 shrinkResources, minifyEnabled를 추가하여 다음과 같이 수정한다. 

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig signingConfigs.debug
            shrinkResources false    
            minifyEnabled false      
        }
    }

No Space left on device

라즈베리파이, 나노파이로 작업할 때에 ‘No Space left on device’ 메시지를 볼 때가 있다.

이 때에

df -l

을 입력하면, 현재 디스크의 용량 상황을 볼 수 있다.

pi@Heitu_PG_Lite:~$ df -l
Filesystem     1K-blocks    Used Available Use% Mounted on
udev              214920       0    214920   0% /dev
tmpfs              50320    3104     47216   7% /run
overlay          6346024 2926552   3403088  47% /
tmpfs             251584    4192    247392   2% /dev/shm
tmpfs               5120       4      5116   1% /run/lock
tmpfs             251584       0    251584   0% /sys/fs/cgroup
/dev/mmcblk0p1     40862   12006     28856  30% /boot
tmpfs              50320      32     50288   1% /run/user/1000
/dev/mmcblk0p3   6346024 2926552   3403088  47% /media/pi/userdata3

하지만, 사용량이 100%가 아닌 경우인데도 에러메시지가 뜨는 경우가 왕왕 있다.

df -i

df -i 명령어를 입력하면, inode 점유율을 볼 수 가 있는데, 이 때에 Use 100%인 디스크가 있으면, 해당 디스크의 파일을 지워 아이노드를 확보한다. 아래 명령어를 입력하면, 현재 폴더의 아이노드 점유 순위를 오름차순으로 볼 수 있다.

sudo find . -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n

아이노드 점유가 높은 폴더로 이동하여 적절히 삭제하여주자!

Gopro API 제어

사용모델: Gopro hero 10 black

OS: Ubuntu 20.04 LTS

SDK, 데모 등 리소스는 github에서 다운로드 가능 (https://github.com/gopro/OpenGoPro)

Gopro python SDK 설치

pip install open-gopro

컴퓨터와 gopro 페어링

gopro에서 quick app 연결화면에 진입한다.

Quik

PC에서 터미널을 실행한 후 아래 명령 입력.

bluetoothctl

[bluetooth]# connect F3:EA:9A:C0:FF:FF

여기서 F3:EA:9A:C0:FF:FF 형태의 MAC 주소는 demo의 tutorial1, ble_connect.py 를 실행하여 알아낼 수도 있으며, 또한 bluetoothctl 쉘에서 scan on 을 입력함으로써 주변 BLE 기기의 MAC 주소를 파악하여 알아낼 수도 있다.

이렇게하여 페어링 완료. 이후에 python SDK 작동

동영상촬영

gopro-video 10 # 10초동안 동영상 촬영 후 파일 자동 다운로드

우분투 업데이트 알림 해제

업데이트 매니저의 시작코드를 수정하기 위하여 /etc/apt/apt.conf.d/99update-notifier 를 주정한다.

nano /etc/apt/apt.conf.d/99update-notifier

다음을 참고하여, ‘#’을 추가하여 주석처리한다.:

#DPkg::Post-Invoke {"if [ -d /var/lib/update-notifier ]; then touch /var/lib/update-notifier/dpkg-run-stamp; fi; if [ -e /var/lib/update-notifier/updates-available ]; then echo > /var/lib/update-notifier/updates-available; fi "; };

아두이노 웹 업데이트 코드

web HTTP updater 

#include <Arduino.h>
#include <WiFi.h>
#include <WiFiMulti.h>
#include <HTTPClient.h>
#include <HTTPUpdate.h>

WiFiMulti WiFiMulti;

void setup() {

  Serial.begin(115200);
  // Serial.setDebugOutput(true);

  Serial.println();
  Serial.println();
  Serial.println();

  for (uint8_t t = 4; t > 0; t--) {
    Serial.printf("[SETUP] WAIT %d...\n", t);
    Serial.flush();
    delay(1000);
  }

  WiFi.mode(WIFI_STA);
  WiFiMulti.addAP("SSID", "PASSWORD");


}

void loop() {
  // wait for WiFi connection
  if ((WiFiMulti.run() == WL_CONNECTED)) {

    WiFiClient client;

    // The line below is optional. It can be used to blink the LED on the board during flashing
    // The LED will be on during download of one buffer of data from the network. The LED will
    // be off during writing that buffer to flash
    // On a good connection the LED should flash regularly. On a bad connection the LED will be
    // on much longer than it will be off. Other pins than LED_BUILTIN may be used. The second
    // value is used to put the LED on. If the LED is on with HIGH, that value should be passed
    // httpUpdate.setLedPin(LED_BUILTIN, LOW);

    t_httpUpdate_return ret = httpUpdate.update(client, "http://webserverdomain/file.bin");
    // Or:
    //t_httpUpdate_return ret = httpUpdate.update(client, "server", 80, "/file.bin");

    switch (ret) {
      case HTTP_UPDATE_FAILED:
        Serial.printf("HTTP_UPDATE_FAILED Error (%d): %s\n", httpUpdate.getLastError(), httpUpdate.getLastErrorString().c_str());
        break;

      case HTTP_UPDATE_NO_UPDATES:
        Serial.println("HTTP_UPDATE_NO_UPDATES");
        break;

      case HTTP_UPDATE_OK:
        Serial.println("HTTP_UPDATE_OK");
        break;
    }
  }
}

아두이노 스케치를 바이너리파일(*.bin)으로 만드는 방법 

-아두이노 IDE를 실행 > 스케치 > 컴파일된 바이너리 내보내기 실행. 

단축키는 Ctrl + Alt + S 

세종CGV-나일강의 죽음

명탐정 포와로가 온다…'나일강의 죽음' 2월 9일 개봉 - 노컷뉴스

제목만 들었을 때는 환경관련 다큐멘터리인 줄 알았다.

한 편의 추리극이었다. 나일강 위에 떠 있는 유람선에서서 발견된 사체와, 또 연속적으로 이어서 알 수 없는 죽음. 그리고 탐정양반의 추리를 영화관에서 지켜보는 관객!

목요일 저녁 8시에 세종CGV에 이 영화를 보러 온 사람은 단 5명이었다. 널찍하게 앉아서 영화에만 집중할 수 있었던.

Onedriver 설치

리눅스용 원드라이브 클라이언트 소프트웨어 – onedriver

Ubuntu20.04LTS 기준
sudo add-apt-repository --remove ppa:jstaf/onedriver
echo 'deb http://download.opensuse.org/repositories/home:/jstaf/xUbuntu_20.04/ /' | sudo tee /etc/apt/sources.list.d/home:jstaf.list
curl -fsSL https://download.opensuse.org/repositories/home:jstaf/xUbuntu_20.04/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/home_jstaf.gpg > /dev/null
sudo apt update
sudo apt install onedriver

ERR_CLEARTEXT_NOT_PERMITTED 해결법

flutter에서 webview_flutter 라이브러리를 이용하여 웹뷰를 작성 시 ERR_CLEARTEXT_NOT_PERMITTED 에러가 발생함.

이는 https로 접속해야하만 제대로 웹페이지를 보여주는 기본 보안설정 때문. 다음 조치로 해결

안드로이드

AndroidManifest.xml 파일 수정하기.

android>app>src>main>AndroidManifest.xml 파일을 열기

application 단락에 다음 내용을 추가

android:usesCleartextTraffic="true"

iOS

ios>Runner>info.plist 파일을 열기

다음내용을 하단에 추가하기

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSAllowsArbitraryLoads</key>
  <true/>
  <key>NSAllowsArbitraryLoadsInWebContent</key>
  <true/>
</dict>