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 1
23 #endif
24 #if PT_API_VERSION != 1
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 #ifdef __GNUC__
32 #define DEPRECATED(func) func __attribute__((deprecated))
33 #else
34 #pragma message("WARNING: Implement DEPRECATED macro, it is missing.")
35 #define DEPRECATED(func) func
36 #endif
37 
38 #include <stdbool.h>
39 #include "pt-client/pt_api.h"
40 
41 #define PT_DEVICE_OBJECT_ID 3
42 #define PT_MANUFACTURER_RESOURCE_ID 0
43 #define PT_MODEL_NUMBER_RESOURCE_ID 1
44 #define PT_SERIAL_NUMBER_RESOURCE_ID 2
45 #define PT_FIRMWARE_VERSION_RESOURCE_ID 3
46 #define PT_REBOOT_RESOURCE_ID 4
47 #define PT_FACTORY_RESET_RESOURCE_ID 5
48 
49 #define PT_ERROR_CODE_RESOURCE_ID 11
50 #define PT_RESET_ERROR_CODE_RESOURCE_ID 12
51 
52 #define PT_DEVICE_TYPE_RESOURCE_ID 17
53 #define PT_HARDWARE_VERSION_RESOURCE_ID 18
54 #define PT_SOFTWARE_VERSION_RESOURCE_ID 19
55 
79 typedef struct ptdo_device_object_data {
80  char *manufacturer;
81  char *model_number;
82  char *serial_number;
86  char *device_type;
91 
109 DEPRECATED(
110  pt_status_t ptdo_initialize_device_object(pt_device_t *device,
111  ptdo_device_object_data_t *device_object_data));
112 
118 #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
char * software_version
Definition: pt_device_object.h:85
char * device_type
Definition: pt_device_object.h:86
pt_resource_callback factory_reset_callback
Definition: pt_device_object.h:88
char * manufacturer
Definition: pt_device_object.h:80
char * firmware_version
Definition: pt_device_object.h:83
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
char * serial_number
Definition: pt_device_object.h:82
char * hardware_version
Definition: pt_device_object.h:84
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
DEPRECATED(pt_status_t ptdo_initialize_device_object(pt_device_t *device, ptdo_device_object_data_t *device_object_data))
Create the device object ID:3.
char * model_number
Definition: pt_device_object.h:81
struct ptdo_device_object_data ptdo_device_object_data_t
The device object data ID:3.
Definition: pt_api.h:325
**Deprecated** Protocol translator client for API v1.