Fix folder count in output
This commit is contained in:
parent
2690c274af
commit
eabbbfa373
2 changed files with 40 additions and 20 deletions
|
@ -78,7 +78,7 @@ int FSService::FSCommandHandler(uint16_t connectionHandle, os_mbuf* om) {
|
||||||
resp.status = 1; // TODO actually use res above!
|
resp.status = 1; // TODO actually use res above!
|
||||||
resp.totalentries = 0;
|
resp.totalentries = 0;
|
||||||
resp.entry = 0;
|
resp.entry = 0;
|
||||||
int sr;
|
|
||||||
int res = fs.DirOpen(path, &dir);
|
int res = fs.DirOpen(path, &dir);
|
||||||
|
|
||||||
NRF_LOG_INFO("[FS_S] ->diropen %d ", res);
|
NRF_LOG_INFO("[FS_S] ->diropen %d ", res);
|
||||||
|
@ -115,7 +115,6 @@ int FSService::FSCommandHandler(uint16_t connectionHandle, os_mbuf* om) {
|
||||||
resp.entry++;
|
resp.entry++;
|
||||||
}
|
}
|
||||||
fs.DirClose(&dir);
|
fs.DirClose(&dir);
|
||||||
resp.entry++;
|
|
||||||
resp.file_size = 0;
|
resp.file_size = 0;
|
||||||
resp.path_length = 0;
|
resp.path_length = 0;
|
||||||
resp.flags = 0;
|
resp.flags = 0;
|
||||||
|
@ -123,6 +122,7 @@ int FSService::FSCommandHandler(uint16_t connectionHandle, os_mbuf* om) {
|
||||||
auto* om = ble_hs_mbuf_from_flat(&resp,sizeof(ListDirResponse)-70+resp.path_length);
|
auto* om = ble_hs_mbuf_from_flat(&resp,sizeof(ListDirResponse)-70+resp.path_length);
|
||||||
ble_gattc_notify_custom(connectionHandle,transferCharacteristicHandle,om);
|
ble_gattc_notify_custom(connectionHandle,transferCharacteristicHandle,om);
|
||||||
NRF_LOG_INFO("[FS_S] -> done ");
|
NRF_LOG_INFO("[FS_S] -> done ");
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -44,23 +44,8 @@ namespace Pinetime {
|
||||||
struct ble_gatt_svc_def serviceDefinition[2];
|
struct ble_gatt_svc_def serviceDefinition[2];
|
||||||
uint16_t versionCharacteristicHandle;
|
uint16_t versionCharacteristicHandle;
|
||||||
uint16_t transferCharacteristicHandle;
|
uint16_t transferCharacteristicHandle;
|
||||||
typedef struct __attribute__((packed)) {
|
|
||||||
uint8_t command;
|
int FSCommandHandler(uint16_t connectionHandle, os_mbuf* om);
|
||||||
uint8_t padding;
|
|
||||||
uint16_t pathlen;
|
|
||||||
char pathstr[70];
|
|
||||||
} ListDirHeader;
|
|
||||||
typedef struct __attribute__((packed)) {
|
|
||||||
uint8_t command;
|
|
||||||
uint8_t status;
|
|
||||||
uint16_t path_length;
|
|
||||||
uint32_t entry;
|
|
||||||
uint32_t totalentries;
|
|
||||||
uint32_t flags;
|
|
||||||
uint32_t modification_time;
|
|
||||||
uint32_t file_size;
|
|
||||||
char path[70];
|
|
||||||
} ListDirResponse;
|
|
||||||
|
|
||||||
enum class commands : uint8_t {
|
enum class commands : uint8_t {
|
||||||
INVALID = 0x00,
|
INVALID = 0x00,
|
||||||
|
@ -80,7 +65,42 @@ namespace Pinetime {
|
||||||
MOVE_STATUS = 0x61
|
MOVE_STATUS = 0x61
|
||||||
};
|
};
|
||||||
|
|
||||||
int FSCommandHandler(uint16_t connectionHandle, os_mbuf* om);
|
using ListDirHeader = struct __attribute__((packed)) {
|
||||||
|
uint8_t command;
|
||||||
|
uint8_t padding;
|
||||||
|
uint16_t pathlen;
|
||||||
|
char pathstr[70];
|
||||||
|
};
|
||||||
|
|
||||||
|
using ListDirResponse = struct __attribute__((packed)) {
|
||||||
|
uint8_t command;
|
||||||
|
uint8_t status;
|
||||||
|
uint16_t path_length;
|
||||||
|
uint32_t entry;
|
||||||
|
uint32_t totalentries;
|
||||||
|
uint32_t flags;
|
||||||
|
uint32_t modification_time;
|
||||||
|
uint32_t file_size;
|
||||||
|
char path[70];
|
||||||
|
};
|
||||||
|
|
||||||
|
using MKDirHeader = struct __attribute__((packed)) {
|
||||||
|
uint8_t command;
|
||||||
|
uint8_t padding;
|
||||||
|
uint16_t pathlen;
|
||||||
|
uint32_t padding2;
|
||||||
|
uint64_t time;
|
||||||
|
char pathstr[70];
|
||||||
|
};
|
||||||
|
|
||||||
|
using MKDirResponse = struct __attribute__((packed)) {
|
||||||
|
uint8_t command;
|
||||||
|
uint8_t status;
|
||||||
|
uint32_t padding1;
|
||||||
|
uint16_t padding2;
|
||||||
|
uint64_t modification_time;
|
||||||
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue