build-system: add missing blob to tarball
[platform/upstream/libatasmart.git] / atasmart.vapi
1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
2
3 /***
4     This file is part of libatasmart.
5
6     Copyright 2008 Lennart Poettering
7
8     libatasmart is free software; you can redistribute it and/or modify
9     it under the terms of the GNU Lesser General Public License as
10     published by the Free Software Foundation, either version 2.1 of the
11     License, or (at your option) any later version.
12
13     libatasmart is distributed in the hope that it will be useful, but
14     WITHOUT ANY WARRANTY; without even the implied warranty of
15     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16     Lesser General Public License for more details.
17
18     You should have received a copy of the GNU Lesser General Public
19     License along with libatasmart. If not, If not, see
20     <http://www.gnu.org/licenses/>.
21 ***/
22
23 using GLib;
24
25 [CCode (cheader_filename="atasmart.h")]
26 namespace Smart {
27
28         [CCode (cname="SkSmartSelfTest", cprefix="SK_SMART_SELF_TEST_")]
29         public enum SmartSelfTest {
30                 SHORT, EXTENDED, CONVEYANCE, ABORT
31         }
32
33         [Immutable]
34         [CCode (cname="SkIdentifyParsedData")]
35         public struct IdentifyParsedData {
36                 public string serial;
37                 public string firmware;
38                 public string model;
39         }
40
41         [CCode (cname="SkSmartOfflineDataCollectionStatus", cprefix="SK_SMART_OFFLINE_DATA_COLLECTION_STATUS_")]
42         public enum SmartOfflineDataCollectionStatus {
43                 NEVER, SUCCESS, INPROGRESS, SUSPENDED, ABORTED, FATAL, UNKNOWN
44         }
45
46         [CCode (cname="sk_smart_offline_data_collection_status_to_string")]
47         public weak string smart_offline_data_collection_status_to_string(SmartOfflineDataCollectionStatus status);
48
49
50         [CCode (cname="SkSmartSelfTestExecutionStatus", cprefix="SK_SMART_SELF_TEST_EXECUTION_STATUS_")]
51         public enum SmartSelfTestExecutionStatus {
52                 SUCCESS_OR_NEVER, ABORTED, INTERRUPTED, FATAL, ERROR_UNKNOWN, ERROR_ELECTRICAL, ERROR_SERVO, ERROR_READ, ERROR_HANDLING, INPROGRESS
53         }
54
55         [CCode (cname="sk_smart_self_test_execution_status_to_string")]
56         public weak string smart_self_test_execution_status_to_string(SmartSelfTestExecutionStatus status);
57
58         [Immutable]
59         [CCode (cname="SkSmartParsedData")]
60         public struct SmartParsedData {
61                 public SmartOfflineDataCollectionStatus offline_data_collection_status;
62                 public uint total_offline_data_collection_seconds;
63                 public SmartSelfTestExecutionStatus self_test_execution_status;
64                 public uint self_test_execution_percent_remaining;
65
66                 public bool conveyance_test_available;
67                 public bool short_and_extended_test_available;
68                 public bool start_test_available;
69                 public bool abort_test_available;
70
71                 public uint short_test_polling_minutes;
72                 public uint extended_test_polling_minutes;
73                 public uint conveyance_test_polling_minutes;
74
75                 [CCode (cname="sk_smart_self_test_available")]
76                 public bool self_test_available(SmartSelfTest test);
77
78                 [CCode (cname="sk_smart_self_test_polling_minutes")]
79                 public uint self_test_polling_minutes(SmartSelfTest test);
80         }
81
82         [CCode (cname="SkSmartAttributeUnit", cprefix="SK_SMART_ATTRIBUTE_UNIT_")]
83         public enum SmartAttributeUnit {
84                 UNKNOWN, NONE, MSECONDS, SECTORS, MKELVIN
85         }
86
87         [CCode (cname="sk_smart_attribute_unit_to_string")]
88         public weak string smart_attribute_unit_to_string(SmartAttributeUnit unit);
89
90         [Immutable]
91         [CCode (cname="SkSmartAttributeParsedData")]
92         public struct SmartAttributeParsedData {
93                 public uint8 id;
94                 public string name;
95                 public SmartAttributeUnit pretty_unit;
96                 public uint16 flags;
97                 public uint8 threshold;
98                 public bool threshold_valid;
99                 public bool online;
100                 public bool prefailure;
101                 public bool good;
102                 public uint8 current_value;
103                 public uint8 worst_value;
104                 public uint64 pretty_value;
105                 public uint8[6] raw;
106         }
107
108         [CCode (cname="SkSmartAttributeParseCallback")]
109         public delegate void SmartAttributeParseCallback(void* disk, SmartAttributeParsedData a);
110
111         [Compact]
112         [CCode (free_function="sk_disk_free", cname="SkDisk", cprefix="sk_disk_")]
113         public class Disk {
114
115                 public static int open(string name, out Disk disk);
116
117                 public int get_size(out uint64 bytes);
118
119                 public int check_sleep_mode(out bool awake);
120
121                 public int identify_is_available(out bool available);
122                 public int identify_parse(out weak IdentifyParsedData* data);
123
124                 public int smart_is_available(out bool available);
125                 public int smart_status(out bool good);
126                 public int smart_read_data();
127                 public int smart_parse_attributes(SmartAttributeParseCallback cb);
128                 public int smart_parse(out weak SmartParsedData* data);
129                 public int smart_self_test(SmartSelfTest test);
130
131                 public int dump();
132         }
133
134         /* These two should move to an official vala package */
135         [CCode (cname="errno", cheader_filename="errno.h")]
136         public int errno;
137
138         [CCode (cname="g_strerror", cheader_filename="glib.h")]
139         public weak string strerror(int err);
140 }