Setelah menjalankan program kompresi data sampel pada perangkat, Anda dapat melihat log di perangkat dan di konsol IoT Platform.
Prasyarat
Program kompresi data sampel yang ditulis menggunakan Link SDK for C telah dikonfigurasi. Untuk informasi lebih lanjut, lihat Contoh.
Log perangkat
Anda dapat melihat hasil eksekusi pada perangkat.
Log koneksi.
Jika log berikut dihasilkan, koneksi antara perangkat dan IoT Platform telah berhasil dibuat:
[1673252439.000][LK-0313] MQTT user calls aiot_mqtt_connect api, connect [1673252439.000][LK-032A] mqtt host: xxxxxx.xxxxx.xxxxxx.xxxxxxx.com [1673252439.000][LK-0317] user name: compress_xxxxxxx [1673252439.000][LK-0318] password: 570D5xxxxxxxxx success to establish tcp, fd=3 local port: 47622 [1673252439.100][LK-1000] establish mbedtls connection with server(host='xxxxx.xxxxxx.unify.aliyuncs.com', port=[443]) [1673252439.288][LK-1000] success to establish mbedtls connection, (cost 45326 bytes in total, max used 48294 bytes) [1673252440.111][LK-0313] MQTT connect success in 1109 ms AIOT_MQTTEVT_CONNECTTopik berikut berisi respons terhadap pesan yang dikirim oleh perangkat.
[1673252440.111][LK-0309] sub: /sys/a1xxxxxx/compress_test_001/codec/topic/update_reply suback, res: -0x0000, packet id: 1, max qos: 1Topik-topik berikut digunakan oleh perangkat untuk mengirim pesan.
[1673252440.611][LK-0309] pub: /sys/a1xxxxxxx/compress_test_001/codec/topic/update [LK-030A] > 7B 22 70 61 72 61 6D 73 22 3A 5B 7B 22 74 6F 70 | {"params":[{"top [LK-030A] > 69 63 22 3A 20 22 2F 61 31 68 45 39 36 7A 66 38 | ic": "/a1xxxxxx [LK-030A] > 73 34 2F 63 6F 6D 70 72 65 73 73 5F 74 65 73 74 | /compress_test [LK-030A] > 5F 30 30 31 2F 75 73 65 72 2F 75 70 64 61 74 65 | _001/user/update [LK-030A] > 22 2C 22 6F 70 65 72 61 74 69 6F 6E 22 3A 20 22 | ","operation": " [LK-030A] > 64 65 63 6F 6D 70 72 65 73 73 22 2C 22 66 6F 72 | decompress","for [LK-030A] > 6D 61 74 22 3A 20 22 67 7A 69 70 22 7D 2C 7B 22 | mat": "gzip"},{" [LK-030A] > 74 6F 70 69 63 22 3A 20 22 2F 73 79 73 2F 61 31 | topic": "/sys/a1 [LK-030A] > 68 45 39 36 7A 66 38 73 34 2F 63 6F 6D 70 72 65 | xxxxxx/compre [LK-030A] > 73 73 5F 74 65 73 74 5F 30 30 31 2F 74 68 69 6E | ss_test_001/thin [LK-030A] > 67 2F 65 76 65 6E 74 2F 70 72 6F 70 65 72 74 79 | g/event/property [LK-030A] > 2F 70 6F 73 74 22 2C 22 6F 70 65 72 61 74 69 6F | /post","operatio [LK-030A] > 6E 22 3A 20 22 64 65 63 6F 6D 70 72 65 73 73 22 | n": "decompress" [LK-030A] > 2C 22 66 6F 72 6D 61 74 22 3A 20 22 67 7A 69 70 | ,"format": "gzip [LK-030A] > 22 7D 2C 7B 22 74 6F 70 69 63 22 3A 20 22 2F 61 | "},{"topic": "/a [LK-030A] > 31 68 45 39 36 7A 66 38 73 34 2F 63 6F 6D 70 72 | 1xxxxxxx/compr [LK-030A] > 65 73 73 5F 74 65 73 74 5F 30 30 31 2F 75 73 65 | ess_test_001/use [LK-030A] > 72 2F 75 70 64 61 74 65 5F 72 65 70 6C 79 22 2C | r/update_reply", [LK-030A] > 22 6F 70 65 72 61 74 69 6F 6E 22 3A 20 22 63 6F | "operation": "co [LK-030A] > 6D 70 72 65 73 73 22 2C 22 66 6F 72 6D 61 74 22 | mpress","format" [LK-030A] > 3A 20 22 67 7A 69 70 22 7D 2C 7B 22 74 6F 70 69 | : "gzip"},{"topi [LK-030A] > 63 22 3A 20 22 2F 73 79 73 2F 61 31 68 45 39 36 | c": "/sys/a1xxxxx [LK-030A] > 7A 66 38 73 34 2F 63 6F 6D 70 72 65 73 73 5F 74 | /compress_t [LK-030A] > 65 73 74 5F 30 30 31 2F 74 68 69 6E 67 2F 65 76 | est_001/thing/ev [LK-030A] > 65 6E 74 2F 70 72 6F 70 65 72 74 79 2F 70 6F 73 | ent/property/pos [LK-030A] > 74 5F 72 65 70 6C 79 22 2C 22 6F 70 65 72 61 74 | t_reply","operat [LK-030A] > 69 6F 6E 22 3A 20 22 63 6F 6D 70 72 65 73 73 22 | ion": "compress" [LK-030A] > 2C 22 66 6F 72 6D 61 74 22 3A 20 22 67 7A 69 70 | ,"format": "gzip [LK-030A] > 22 7D 5D 7D | "}]}IoT Platform mengembalikan respons ke perangkat.
[1673252441.266][LK-0309] pub: /sys/a1xxxxxxx/compress_test_001/codec/topic/update_reply [LK-030A] < 7B 22 63 6F 64 65 22 3A 32 30 30 2C 22 6D 65 73 | {"code":200,"mes [LK-030A] < 73 61 67 65 22 3A 22 73 75 63 63 65 73 73 22 7D | sage":"success"} compress update reply code 200, message successPerangkat mengirimkan pesan untuk dikompresi.
Keluaran log menampilkan pesan yang akan dikompresi. Jika
compressedmuncul dalam keluaran, kompresi berhasil.[1673252442.611][LK-0309] pub: /sys/a1xxxxxx/compress_test_001/thing/event/property/post [LK-030A] > 7B 22 69 64 22 3A 22 31 22 2C 22 76 65 72 73 69 | {"id":"1","versi [LK-030A] > 6F 6E 22 3A 22 31 2E 30 22 2C 22 70 61 72 61 6D | on":"1.0","param [LK-030A] > 73 22 3A 7B 22 4C 69 67 68 74 53 77 69 74 63 68 | s":{"LightSwitch [LK-030A] > 22 3A 30 2C 20 22 6D 65 73 73 61 67 65 22 3A 22 | ":0, "message":" [LK-030A] > 74 68 69 73 20 69 73 20 61 20 74 65 73 74 20 6D | this is a test m [LK-030A] > 65 73 73 61 67 65 2C 20 74 68 69 73 20 69 73 20 | essage, this is [LK-030A] > 61 20 74 65 73 74 20 6D 65 73 73 61 67 65 2C 20 | a test message, [LK-030A] > 74 68 69 73 20 69 73 20 61 20 74 65 73 74 20 6D | this is a test m [LK-030A] > 65 73 73 61 67 65 22 7D 7D | essage"}} [1673252442.611][LK-2200] compressed [137] --> [103]IoT Platform mengirimkan pesan terkompresi.
Keluaran log berikut menampilkan pesan yang telah didekompresi. Jika
decompressedmuncul dalam keluaran, dekompresi berhasil.[1673252442.966][LK-2200] decompressed [105] --> [104] [1673252442.966][LK-0309] pub: /sys/a1xxxxxxxx/compress_test_001/thing/event/property/post_reply [LK-030A] < 7B 22 63 6F 64 65 22 3A 32 30 30 2C 22 64 61 74 | {"code":200,"dat [LK-030A] < 61 22 3A 7B 7D 2C 22 69 64 22 3A 22 31 22 2C 22 | a":{},"id":"1"," [LK-030A] < 6D 65 73 73 61 67 65 22 3A 22 73 75 63 63 65 73 | message":"succes [LK-030A] < 73 22 2C 22 6D 65 74 68 6F 64 22 3A 22 74 68 69 | s","method":"thi [LK-030A] < 6E 67 2E 65 76 65 6E 74 2E 70 72 6F 70 65 72 74 | ng.event.propert [LK-030A] < 79 2E 70 6F 73 74 22 2C 22 76 65 72 73 69 6F 6E | y.post","version [LK-030A] < 22 3A 22 31 2E 30 22 7D | ":"1.0"}
Log IoT Platform
Anda dapat masuk ke untuk melihat log setelah menjalankan program sampel.
Di panel navigasi sebelah kiri, pilih Maintenance > Device Log. Setelah memilih produk tempat perangkat tersebut berada, Anda dapat melihat log yang berisi pesan yang dikirimkan oleh perangkat.
Log menampilkan pesan dalam karakter acak. Hal ini terjadi karena IoT Platform menyimpan pesan terkompresi.

Langkah selanjutnya
Jika pesan kesalahan muncul dalam log operasi, Anda dapat menyelesaikan masalah dengan mengikuti petunjuk dalam file aiot_compress_api.h.