Setelah menjalankan contoh kompresi data, Anda dapat memeriksa log operasi di perangkat dan di Konsol Platform IoT untuk memverifikasi hasilnya.
Prasyarat
Contoh kompresi data untuk Link SDK for C harus telah dikonfigurasi. Untuk informasi selengkapnya, lihat Contoh penggunaan.
Log perangkat
Periksa hasil eksekusi berikut pada perangkat.
-
Log koneksi.
Log berikut menunjukkan bahwa perangkat telah terhubung ke Platform IoT.
[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_CONNECT -
Perangkat berlangganan topik pesan respons.
[1673252440.111][LK-0309] sub: /sys/a1xxxxxx/compress_test_001/codec/topic/update_reply suback, res: -0x0000, packet id: 1, max qos: 1 -
Perangkat melaporkan daftar topik.
[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 | "}]} -
Platform IoT mengembalikan hasilnya.
[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 success -
Perangkat melaporkan pesan terkompresi.
Log menampilkan pesan asli sebelum dikompresi. Kata kunci
compressedmenunjukkan bahwa proses kompresi telah selesai.[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] -
Platform IoT mengirimkan pesan terkompresi ke perangkat.
Log menampilkan pesan yang telah didekompresi. Kata kunci
decompressedmenunjukkan bahwa proses dekompresi telah selesai.[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 Platform IoT
Setelah menjalankan contoh tersebut, periksa log operasi di .
Pada panel navigasi sebelah kiri, pilih Maintenance > Device Log. Pilih sebuah Produk untuk melihat log pesannya.
Pesan dalam log mungkin tampak tidak terbaca karena Platform IoT menyimpan konten pesan dalam bentuk terkompresi.
Klik View pada entri log untuk membuka kotak dialog View Details. Kotak dialog tersebut menampilkan topik pesan, seperti /sys/{productKey}/{deviceName}/event/property/post, dan konten pesannya.
Langkah berikutnya
Jika log operasi berisi error, periksa deskripsi kode status dalam file aiot_compress_api.h untuk melakukan pemecahan masalah.