@eohjsc/react-native-smart-city 0.3.69 → 0.3.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@eohjsc/react-native-smart-city",
3
3
  "title": "React Native Smart Home",
4
- "version": "0.3.69",
4
+ "version": "0.3.70",
5
5
  "description": "TODO",
6
6
  "main": "index.js",
7
7
  "files": [
@@ -69,14 +69,14 @@ describe('Test DeviceInternalDetail', () => {
69
69
  const listConfigReads = [
70
70
  {
71
71
  id: 1,
72
- config: { name: 'config1' },
72
+ config: { name: 'config1', is_write: false, is_read: true },
73
73
  value_type: 'boolean',
74
74
  pin_number: 0,
75
75
  pin_mode: 'input',
76
76
  },
77
77
  {
78
78
  id: 2,
79
- config: { name: 'config2' },
79
+ config: { name: 'config2', is_write: false, is_read: true },
80
80
  value_type: 'integer',
81
81
  pin_number: 0,
82
82
  pin_mode: 'input',
@@ -85,14 +85,14 @@ describe('Test DeviceInternalDetail', () => {
85
85
  const listConfigWrites = [
86
86
  {
87
87
  id: 1,
88
- config: { name: 'config1' },
88
+ config: { name: 'config1', is_write: true, is_read: false },
89
89
  value_type: 'boolean',
90
90
  pin_number: 0,
91
91
  pin_mode: 'output',
92
92
  },
93
93
  {
94
94
  id: 2,
95
- config: { name: 'config2' },
95
+ config: { name: 'config2', is_write: true, is_read: true },
96
96
  value_type: 'integer',
97
97
  pin_number: 0,
98
98
  pin_mode: 'output',
@@ -6,10 +6,6 @@ import { axiosGet, axiosDelete, axiosPost } from '../../../utils/Apis/axios';
6
6
  import API from '../../../configs/API';
7
7
  import t from '../../../hooks/Common/useTranslations';
8
8
 
9
- const WRITE_PIN_MODE = ['output', 'open_drain', 'pwm'];
10
-
11
- const READ_PIN_MODE = ['input', 'input_pull_up', 'input_pull_down', 'analog'];
12
-
13
9
  export const useGateway = () => {
14
10
  const navigation = useNavigation();
15
11
  const [refresh, setRefresh] = useState(false);
@@ -68,12 +64,8 @@ export const useGateway = () => {
68
64
  API.DEV_MODE.ARDUINO.CONFIG_PINS(gatewayId, deviceId)
69
65
  );
70
66
  if (success) {
71
- const config_read = data?.filter((item) =>
72
- READ_PIN_MODE.includes(item?.pin_mode)
73
- );
74
- const config_write = data?.filter((item) =>
75
- WRITE_PIN_MODE.includes(item?.pin_mode)
76
- );
67
+ const config_read = data?.filter((item) => item?.config?.is_read);
68
+ const config_write = data?.filter((item) => item?.config?.is_write);
77
69
  setDetailDeviceInternal((prev) => ({
78
70
  ...prev,
79
71
  config_read,