1060ff233Sopenharmony_ci/* 2060ff233Sopenharmony_ci * Copyright (C) 2021-2023 Huawei Device Co., Ltd. 3060ff233Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4060ff233Sopenharmony_ci * you may not use this file except in compliance with the License. 5060ff233Sopenharmony_ci * You may obtain a copy of the License at 6060ff233Sopenharmony_ci * 7060ff233Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8060ff233Sopenharmony_ci * 9060ff233Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10060ff233Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11060ff233Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12060ff233Sopenharmony_ci * See the License for the specific language governing permissions and 13060ff233Sopenharmony_ci * limitations under the License. 14060ff233Sopenharmony_ci */ 15060ff233Sopenharmony_ci 16060ff233Sopenharmony_ci#ifndef JSON_PAYLOAD_H 17060ff233Sopenharmony_ci#define JSON_PAYLOAD_H 18060ff233Sopenharmony_ci 19060ff233Sopenharmony_ci#include <stdint.h> 20060ff233Sopenharmony_ci#include "nstackx.h" 21060ff233Sopenharmony_ci 22060ff233Sopenharmony_ci#ifdef __cplusplus 23060ff233Sopenharmony_ciextern "C" { 24060ff233Sopenharmony_ci#endif 25060ff233Sopenharmony_ci 26060ff233Sopenharmony_ci#define NSTACKX_MAX_URI_BUFFER_LENGTH 64 27060ff233Sopenharmony_ci 28060ff233Sopenharmony_ci#define JSON_COAP_URI "coapUri" 29060ff233Sopenharmony_ci#define JSON_CAPABILITY_BITMAP "capabilityBitmap" 30060ff233Sopenharmony_ci#define JSON_DEVICE_ID "deviceId" 31060ff233Sopenharmony_ci#define JSON_DEVICE_NAME "devicename" 32060ff233Sopenharmony_ci#define JSON_DEVICE_WLAN_IP "wlanIp" 33060ff233Sopenharmony_ci#define JSON_DEVICE_TYPE "type" 34060ff233Sopenharmony_ci#define JSON_DEVICE_TYPE_EXTERN "typeEx" 35060ff233Sopenharmony_ci#define JSON_REQUEST_MODE "mode" 36060ff233Sopenharmony_ci#define JSON_DEVICE_HASH "deviceHash" 37060ff233Sopenharmony_ci#define JSON_SERVICE_DATA "serviceData" 38060ff233Sopenharmony_ci#define JSON_BUSINESS_TYPE "bType" 39060ff233Sopenharmony_ci#define JSON_BUSINESS_DATA "bData" 40060ff233Sopenharmony_ci#define JSON_EXTEND_SERVICE_DATA "extendServiceData" 41060ff233Sopenharmony_ci#define JSON_SEQUENCE_NUMBER "seqNo" 42060ff233Sopenharmony_ci#define JSON_NOTIFICATION "notify" 43060ff233Sopenharmony_ci 44060ff233Sopenharmony_ci#ifdef DFINDER_USE_MINI_NSTACKX 45060ff233Sopenharmony_ci#define COAP_DEVICE_DISCOVER_URI "device_discover" 46060ff233Sopenharmony_ci#endif 47060ff233Sopenharmony_ci 48060ff233Sopenharmony_cistruct DeviceInfo; 49060ff233Sopenharmony_ci 50060ff233Sopenharmony_cichar *PrepareServiceDiscover(const char *localIpStr, uint8_t isBroadcast, uint8_t businessType); 51060ff233Sopenharmony_ciint32_t ParseServiceDiscover(const uint8_t *buf, struct DeviceInfo *deviceInfo, char **remoteUrlPtr); 52060ff233Sopenharmony_cichar *PrepareServiceNotification(void); 53060ff233Sopenharmony_ciint32_t ParseServiceNotification(const uint8_t *buf, NSTACKX_NotificationConfig *config); 54060ff233Sopenharmony_ci 55060ff233Sopenharmony_ci#ifdef __cplusplus 56060ff233Sopenharmony_ci} 57060ff233Sopenharmony_ci#endif 58060ff233Sopenharmony_ci#endif /* #ifndef JSON_PAYLOAD_H */ 59