'2019/05'에 해당되는 글 2건

IoT Open House/ThingPlug

SKT의 LoRa 단말의 데이터는 SKT의 ThingPlug로 저장된다.

따라서 SKT LoRa 개발자는 ThingPlug 상에서 LoRa 단말의 데이터가 정상적으로 전송되었는지 체크할 수 있다.

 

이 포스팅에서는 Postman이라는 API 테스트 툴을 활용해서 SKT LoRa 단말의 데이터를 확인하는 기본 방법에 대해서 작성한다.

 

자세한 내용은 IoT 오픈하우스를 통해 문의할 수 있다.

https://www.sktiot.com/iot/support/openhouse/reservation/openhouseMain

 

SK telecom IoT Portal

목적 - 기술지원을 통한 서비스 개발 및 상용화 기간 단축 - 개발자 지원을 통한 자생적 개발환경 조성 및 LoRa, Cat.M1, LTE-M 생태계 활성화 지원대상 - LoRa, Cat.M1, LTE-M 단말 및 서비스 상용화 준비중인 중소기업 및 스타트업 지원업무 - 기술지원을 통한 서비스 개발 및 상용화 기간 단축 - 개발자 지원을 통한 자생적 개발환경 조성 및 LoRa, Cat.M1, LTE-M 생태계 활성화 지원업무 설명 컨설팅 기획/개발, 디바

www.sktiot.com

 

앞서 설명한대로, SKT LoRa는 ThingPlug로 연동되며, 사용자 앱서버에서는 MQTT나 HTTP로 LoRa 단말의 데이터 조회와 제어 등을 할 수 있다.

 

 

 

API를 사용하기 위해서는 우선 ThingPlug에서 발급해주는 ukey(사용자 인증키)가 필요하다.

(ThingPlug 가입/단말 등록 등은 이번 포스팅에서 다루지 않음.)

 

테스트 툴은 postman이라는 API 테스트 툴을 사용한다.

https://www.getpostman.com/

 

Postman | API Development Environment

Postman is the only complete API development environment used by more than 6 million developers and 200,000 companies worldwide.

www.getpostman.com

 

그리고 아래 script를 다운로드한다. script는 두 종류로 나누어져 있는데, 테스트 script와 ukey, 단말 id 등 환경 변수를 입력하는 파일로 나뉘어져 있다.

 

https://github.com/wpgnss/thingplug_lora_script

 

wpgnss/thingplug_lora_script

Contribute to wpgnss/thingplug_lora_script development by creating an account on GitHub.

github.com

 

두 파일의 사용법은 아래와 같다.

우선, [Script]_ThingPlug_API.postman.json 파일을 postman에서 import 한다.

 

다음은 [Env]_ThingPlug.postman.json 파일로 환경 변수파일을 추가로 import 한다.

 

환경변수 파일을 import 하면 아래처럼 각각 value를 입력할 수 있으며, 테스트를 위해 최대한 입력한다.

최소한 app_eui, ltid, uKey, platform_url은 입력되어 있어야 기본 테스트를 진행할 수 있다.

 

Study/Python

펌웨어 바이너리 파일 등 hexadecimal 값을 가독성이 좋은 형태로 변환해야 하는 경우가 있다.

 

예를들면

0x00 0x11 0x22 ...  => 001122 의 형태로

 

간단하게

import binascii

binascii.hexlify(), binascii.unhexlify()를 활용하면 된다.

 

 

의 결과 값은 아래와 같다.

 

 

character '1'의 hex 값은 0x31이다.

http://www.asciitable.com/

 

Ascii Table - ASCII character codes and html, octal, hex and decimal chart conversion

ASCII Table and Description ASCII stands for American Standard Code for Information Interchange. Computers can only understand numbers, so an ASCII code is the numerical representation of a character such as 'a' or '@' or an action of some sort. ASCII was

www.asciitable.com

 

 

만약 특정 바이너리 파일을 모두 컨버팅 하기 위해서는 아래와 같이 하면 된다.

결과.

 

'Study > Python' 카테고리의 다른 글

python 함수 주기적으로 실행하기  (0) 2017.01.25
python Queue 사용방법  (0) 2017.01.25
1
블로그 이미지

IoT 개발자 블로그이고 싶다.

1byte