Notefile DeleteNote
(ctx context.Context, session *HubSession, req notehubMessage, rsp *notehubMessage, event EventFunc)
| 1306 | |
| 1307 | // Notefile DeleteNote |
| 1308 | func hubNotefileDeleteNote(ctx context.Context, session *HubSession, req notehubMessage, rsp *notehubMessage, event EventFunc) (err error) { |
| 1309 | // Open the box |
| 1310 | box, ei, _, err2 := openHubNoteboxForDevice(ctx, session, req.DeviceUID, req.DeviceSN, req.ProductUID, req.DeviceEndpointID, event) |
| 1311 | if err2 != nil { |
| 1312 | err = err2 |
| 1313 | return |
| 1314 | } |
| 1315 | |
| 1316 | // Open the specified notefile |
| 1317 | openfile, file, err4 := box.OpenNotefile(ctx, req.NotefileID) |
| 1318 | if err4 != nil { |
| 1319 | err = err4 |
| 1320 | box.Close(ctx) |
| 1321 | return |
| 1322 | } |
| 1323 | sawNotefile(session, box, req.NotefileID) |
| 1324 | |
| 1325 | // Perform the operation |
| 1326 | err = file.DeleteNote(ctx, ei, req.DeviceEndpointID, req.NoteID) |
| 1327 | if err != nil { |
| 1328 | openfile.Close(ctx) |
| 1329 | box.Close(ctx) |
| 1330 | return err |
| 1331 | } |
| 1332 | |
| 1333 | // Done |
| 1334 | openfile.Close(ctx) |
| 1335 | box.Close(ctx) |
| 1336 | |
| 1337 | return nil |
| 1338 | } |
| 1339 | |
| 1340 | // Notefile UpdateNote |
| 1341 | func hubNotefileUpdateNote(ctx context.Context, session *HubSession, req notehubMessage, rsp *notehubMessage, event EventFunc) (err error) { |
no test coverage detected