-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
111 lines (107 loc) · 3.66 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import React, { useState } from "react";
import { Text, View, Button, ScrollView } from "react-native";
import { infoButtonControl } from "./theta_control/info-button-control";
import { stateButtonControl } from "./theta_control/state-button-control";
import { listFilesButtonControl} from "./theta_control/list-files-button-control";
import {takePictureButtonControl} from "./theta_control/take-picture-button-control";
import { setVideoButtonControl } from "./theta_control/set-video-button-control";
import { setImageButtonControl } from "./theta_control/set-image-button-control";
import { styles } from "./styles";
export default function App() {
// fake-theta
// const urlEndpoint = "https://fake-theta.vercel.app/osc/";
// real theta physical device in access point mode
const urlEndpoint = "http://192.168.1.1/osc/";
// end camera endpoint config
const [responseWindow, onChangeResponseWindow] = useState(
"press button to test API"
);
return (
<ScrollView style={styles.container}>
<View style={styles.headerContainer}>
<Text style={styles.headerText}>RICOH THETA JavaScript Demo</Text>
</View>
<View style={styles.buttonRow}>
<View style={styles.buttonContainer}>
<Button
style={styles.button}
title="info"
onPress={() => {
infoButtonControl(urlEndpoint).then(function (data) {
console.log(data);
onChangeResponseWindow(data);
});
}}
></Button>
</View>
<View style={styles.buttonContainer}>
<Button
style={styles.button}
title="state"
onPress={() => {
stateButtonControl(urlEndpoint).then(function (data) {
console.log(data);
onChangeResponseWindow(data);
});
}}
></Button>
</View>
<View style={styles.buttonContainer}>
<Button
style={styles.button}
title="file"
onPress={() => {
listFilesButtonControl(urlEndpoint).then(function (data) {
console.log(data);
onChangeResponseWindow(data);
});
}}
></Button>
</View>
<View style={styles.buttonContainer}>
<Button
style={styles.button}
title="pic"
onPress={() => {
takePictureButtonControl(urlEndpoint).then(function (data) {
console.log(data);
onChangeResponseWindow(data);
});
}}
></Button>
</View>
</View>
{/* start of second row of buttons */}
<View style={styles.buttonRow}>
<View style={styles.buttonContainer}>
<Button
style={styles.button}
title="video"
onPress={() => {
setVideoButtonControl(urlEndpoint).then(function (data) {
console.log(data);
onChangeResponseWindow(data);
});
}}
></Button>
</View>
<View style={styles.buttonContainer}>
<Button
style={styles.button}
title="image"
onPress={() => {
setImageButtonControl(urlEndpoint).then(function (data) {
console.log(data);
onChangeResponseWindow(data);
});
}}
></Button>
</View>
</View>
{/* end of second row of buttons */}
<View style={styles.responseWindowContainer}>
<Text>{responseWindow}</Text>
</View>
</ScrollView>
);
}