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