File tree 1 file changed +18
-0
lines changed
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -146,3 +146,21 @@ func (c *Characteristic) Write(p []byte) (n int, err error) {
146
146
147
147
return len (p ), nil
148
148
}
149
+
150
+ // GetAttributes retrieves persistent system attribute information
151
+ // Use together with SetAttributes to save and restore characteristic state
152
+ func (c * Characteristic ) GetAttributes (p []byte ) (n int , err error ) {
153
+ connHandle := currentConnection .Get ()
154
+ p_len := uint16 (len (p ))
155
+ errCode := C .sd_ble_gatts_sys_attr_get (connHandle , & p [0 ], & p_len , 0 )
156
+ return int (p_len ), makeError (errCode )
157
+ }
158
+
159
+ // SetAttributes updates persistent system attribute information
160
+ // Use together with GetAttributes to save and restore characteristic state
161
+ func (c * Characteristic ) SetAttributes (p []byte ) (err error ) {
162
+ connHandle := currentConnection .Get ()
163
+ p_len := uint16 (len (p ))
164
+ errCode := C .sd_ble_gatts_sys_attr_set (connHandle , & p [0 ], p_len , 0 )
165
+ return makeError (errCode )
166
+ }
You can’t perform that action at this time.
0 commit comments