Mistake on this page? Email us
pt_device_object.h
Go to the documentation of this file.
1 /*
2  * ----------------------------------------------------------------------------
3  * Copyright 2018 ARM Ltd.
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ----------------------------------------------------------------------------
19  */
20 
21 #ifndef PT_API_VERSION
22 #define PT_API_VERSION 2
23 #endif
24 #if PT_API_VERSION != 2
25 #error "Including mixed versions of Protocol API"
26 #endif
27 
28 #ifndef PT_DEVICE_OBJECT_H_
29 #define PT_DEVICE_OBJECT_H_
30 
31 #include <stdbool.h>
32 #include "pt-client-2/pt_api.h"
33 
34 #define PT_DEVICE_OBJECT_ID 3
35 #define PT_MANUFACTURER_RESOURCE_ID 0
36 #define PT_MODEL_NUMBER_RESOURCE_ID 1
37 #define PT_SERIAL_NUMBER_RESOURCE_ID 2
38 #define PT_FIRMWARE_VERSION_RESOURCE_ID 3
39 #define PT_REBOOT_RESOURCE_ID 4
40 #define PT_FACTORY_RESET_RESOURCE_ID 5
41 
42 #define PT_ERROR_CODE_RESOURCE_ID 11
43 #define PT_RESET_ERROR_CODE_RESOURCE_ID 12
44 
45 #define PT_DEVICE_TYPE_RESOURCE_ID 17
46 #define PT_HARDWARE_VERSION_RESOURCE_ID 18
47 #define PT_SOFTWARE_VERSION_RESOURCE_ID 19
48 
68 typedef struct ptdo_device_object_data {
69  const char *manufacturer;
70  const char *model_number;
71  const char *serial_number;
72  const char *firmware_version;
73  const char *hardware_version;
74  const char *software_version;
75  const char *device_type;
80 
100 pt_status_t ptdo_initialize_device_object(connection_id_t connection_id,
101  const char *device_id,
102  const ptdo_device_object_data_t *device_object_data);
103 
109 #endif /* PT_DEVICE_OBJECT_H_ */
The device object data ID:3.
Definition: pt_device_object.h:79
pt_resource_callback reset_error_code_callback
Definition: pt_device_object.h:89
pt_resource_callback factory_reset_callback
Definition: pt_device_object.h:88
pt_status_t ptdo_initialize_device_object(connection_id_t connection_id, const char *device_id, const ptdo_device_object_data_t *device_object_data)
Create the device object ID:3.
pt_resource_callback reboot_callback
Definition: pt_device_object.h:87
Protocol translator external API V2.
const char * serial_number
Definition: pt_device_object.h:71
const char * device_type
Definition: pt_device_object.h:75
const char * software_version
Definition: pt_device_object.h:74
const char * model_number
Definition: pt_device_object.h:70
const char * manufacturer
Definition: pt_device_object.h:69
pt_status_t(* pt_resource_callback)(const connection_id_t connection_id, const char *device_id, const uint16_t object_id, const uint16_t object_instance_id, const uint16_t resource_id, const uint8_t operation, const uint8_t *value, const uint32_t size, void *userdata)
Callback function prototype for the device resource specific action on OPERATION_WRITE or OPERATION_E...
Definition: pt_api.h:182
const char * hardware_version
Definition: pt_device_object.h:73
const char * firmware_version
Definition: pt_device_object.h:72
struct ptdo_device_object_data ptdo_device_object_data_t
The device object data ID:3.