Struct divoom::PixooCommandBuilder
source · [−]pub struct PixooCommandBuilder { /* private fields */ }
Expand description
Pixoo command builder for creating the JSON payload of Pixoo commands.
Implementations
sourceimpl PixooCommandBuilder
impl PixooCommandBuilder
Constructors, builder and executor
pub async fn execute_with_raw_response(self) -> DivoomAPIResult<String>
pub async fn execute(self) -> DivoomAPIResult<()>
sourceimpl PixooCommandBuilder
impl PixooCommandBuilder
Channel API implementations
sourcepub fn select_channel(
self,
channel_type: DivoomChannelType
) -> PixooCommandBuilder
pub fn select_channel(
self,
channel_type: DivoomChannelType
) -> PixooCommandBuilder
Select channel
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=89
The channel is the top category of the display content.
sourcepub fn get_current_channel(self) -> PixooCommandBuilder
pub fn get_current_channel(self) -> PixooCommandBuilder
sourcepub fn select_clock(self, clock_id: i32) -> PixooCommandBuilder
pub fn select_clock(self, clock_id: i32) -> PixooCommandBuilder
sourcepub fn get_selected_clock_info(self) -> PixooCommandBuilder
pub fn get_selected_clock_info(self) -> PixooCommandBuilder
Get selected clock id
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=239
Sample response:
{
"ClockId": 12,
"Brightness":100
}
sourcepub fn select_cloud_channel(
self,
channel_type: DivoomCloudChannelType
) -> PixooCommandBuilder
pub fn select_cloud_channel(
self,
channel_type: DivoomCloudChannelType
) -> PixooCommandBuilder
sourcepub fn select_visualizer(self, visializer_index: i32) -> PixooCommandBuilder
pub fn select_visualizer(self, visializer_index: i32) -> PixooCommandBuilder
sourcepub fn select_custom_page(self, custom_page_index: i32) -> PixooCommandBuilder
pub fn select_custom_page(self, custom_page_index: i32) -> PixooCommandBuilder
sourceimpl PixooCommandBuilder
impl PixooCommandBuilder
System API implementations
sourcepub fn get_device_settings(self) -> PixooCommandBuilder
pub fn get_device_settings(self) -> PixooCommandBuilder
Get all settings
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=243
Sample response:
{
"error_code": 0,
"Brightness":100,
"RotationFlag":1,
"ClockTime":60,
"GalleryTime":60,
"SingleGalleyTime":5,
"PowerOnChannelId":1,
"GalleryShowTimeFlag":1,
"CurClockId":1,
"Time24Flag":1,
"TemperatureMode":1,
"GyrateAngle":1,
"MirrorFlag":1,
"LightSwitch":1
}
sourcepub fn get_device_time(self) -> PixooCommandBuilder
pub fn get_device_time(self) -> PixooCommandBuilder
Get device time
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=337
Sample response:
{
"error_code": 0,
"UTCTime":1647200428,
"LocalTime":"2022-03-14 03:40:28"
}
sourcepub fn set_device_brightness(self, brightness: i32) -> PixooCommandBuilder
pub fn set_device_brightness(self, brightness: i32) -> PixooCommandBuilder
Set brightness
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=196
sourcepub fn set_device_time(self, utc: u64) -> PixooCommandBuilder
pub fn set_device_time(self, utc: u64) -> PixooCommandBuilder
Set system time
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=222
Sample request:
{
"Command":"Device/SetUTC",
"Utc": 1672416000
}
sourcepub fn set_device_high_light_mode(
self,
mode: DivoomDeviceHighLightMode
) -> PixooCommandBuilder
pub fn set_device_high_light_mode(
self,
mode: DivoomDeviceHighLightMode
) -> PixooCommandBuilder
Set high light mode
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=342
Sample request:
{
"Command": "Device/SetHighLightMode",
"Mode": 0
}
sourcepub fn set_device_hour_mode(
self,
mode: DivoomDeviceHourMode
) -> PixooCommandBuilder
pub fn set_device_hour_mode(
self,
mode: DivoomDeviceHourMode
) -> PixooCommandBuilder
Set hour mode
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=341
Sample request:
{
"Command": "Device/SetTime24Flag",
"Mode": 0
}
sourcepub fn set_device_mirror_mode(
self,
mode: DivoomDeviceMirrorMode
) -> PixooCommandBuilder
pub fn set_device_mirror_mode(
self,
mode: DivoomDeviceMirrorMode
) -> PixooCommandBuilder
Set mirror mode
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=340
Sample request:
{
"Command": "Device/SetMirrorMode",
"Mode": 0
}
sourcepub fn set_device_rotation_angle(
self,
mode: DivoomDeviceRotationAngle
) -> PixooCommandBuilder
pub fn set_device_rotation_angle(
self,
mode: DivoomDeviceRotationAngle
) -> PixooCommandBuilder
Set rotation angle
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=339
Sample request:
{
"Command": "Device/SetScreenRotationAngle",
"Mode": 0
}
sourcepub fn set_device_screen_power_state(
self,
power_state: DivoomDeviceScreenPowerState
) -> PixooCommandBuilder
pub fn set_device_screen_power_state(
self,
power_state: DivoomDeviceScreenPowerState
) -> PixooCommandBuilder
Set screen power state (on/off)
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=223
Sample request:
{
"Command":"Channel/OnOffScreen",
"OnOff": 1
}
sourcepub fn set_device_temperature_unit(
self,
unit: DivoomDeviceTemperatureUnit
) -> PixooCommandBuilder
pub fn set_device_temperature_unit(
self,
unit: DivoomDeviceTemperatureUnit
) -> PixooCommandBuilder
Set temperature unit
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=338
Sample request:
{
"Command":"Device/SetDisTempMode",
"Mode":0
}
sourcepub fn set_device_time_zone(self, time_zone: String) -> PixooCommandBuilder
pub fn set_device_time_zone(self, time_zone: String) -> PixooCommandBuilder
Set time zone
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=221
Sample request:
{
"Command":"Sys/TimeZone",
"TimeZoneValue": "GMT-5"
}
sourcepub fn set_device_weather_area(
self,
longitude: String,
latitude: String
) -> PixooCommandBuilder
pub fn set_device_weather_area(
self,
longitude: String,
latitude: String
) -> PixooCommandBuilder
Set weather area
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=220
Sample request:
{
"Command":"Sys/LogAndLat",
"Longitude": "30.29",
"Latitude":"20.58"
}
sourcepub fn set_device_white_balance(
self,
r: i32,
g: i32,
b: i32
) -> PixooCommandBuilder
pub fn set_device_white_balance(
self,
r: i32,
g: i32,
b: i32
) -> PixooCommandBuilder
Set white balance
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=343
Sample request:
{
"Command":"Device/SetWhiteBalance",
"RValue":100,
"GValue":100,
"BValue":100
}
sourceimpl PixooCommandBuilder
impl PixooCommandBuilder
Tool API implementations
sourcepub fn set_countdown_tool(
self,
minute: i32,
second: i32,
action: DivoomToolCountdownAction
) -> PixooCommandBuilder
pub fn set_countdown_tool(
self,
minute: i32,
second: i32,
action: DivoomToolCountdownAction
) -> PixooCommandBuilder
Set countdown tool
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=224
Sample request:
{
"Command":"Tools/SetTimer",
"Minute": 1,
"Second": 0,
"Status": 1
}
sourcepub fn set_noise_tool(self, action: DivoomToolNoiseAction) -> PixooCommandBuilder
pub fn set_noise_tool(self, action: DivoomToolNoiseAction) -> PixooCommandBuilder
Set noise tool
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=227
Sample request:
{
"Command":"Tools/SetNoiseStatus",
"NoiseStatus": 1
}
sourcepub fn set_scoreboard_tool(
self,
blue_score: i32,
red_score: i32
) -> PixooCommandBuilder
pub fn set_scoreboard_tool(
self,
blue_score: i32,
red_score: i32
) -> PixooCommandBuilder
Set scroeboard tool
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=226
Sample request:
{
"Command":"Tools/SetScoreBoard",
"BlueScore": 100,
"RedScore": 79
}
sourcepub fn set_stopwatch_tool(
self,
action: DivoomToolStopwatchAction
) -> PixooCommandBuilder
pub fn set_stopwatch_tool(
self,
action: DivoomToolStopwatchAction
) -> PixooCommandBuilder
Set stopwatch tool
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=225
Sample request:
{
"Command":"Tools/SetStopWatch",
"Status": 1
}
sourceimpl PixooCommandBuilder
impl PixooCommandBuilder
Animation API implementations
sourcepub fn play_gif_file(
self,
file_type: DivoomFileAnimationSourceType,
file_name: String
) -> PixooCommandBuilder
pub fn play_gif_file(
self,
file_type: DivoomFileAnimationSourceType,
file_name: String
) -> PixooCommandBuilder
Play gif file
Play GIF file from specific location.
NOTE: this API onliy supports 16x16, 32x32 and 64x64 GIFs. If other format is specified, it could cause the device to crash and reboot.
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=195
This API will generate requests like below:
{
"Command":"Device/PlayTFGif",
"FileType": 0,
"FileName":"divoom_gif/1.gif"
},
{
"Command":"Device/PlayTFGif",
"FileType": 1,
"FileName":"divoom_gif"
},
{
"Command":"Device/PlayTFGif",
"FileType": 2,
"FileName":"http://f.divoom-gz.com/64_64.gif"
}
sourcepub fn get_next_animation_id(self) -> PixooCommandBuilder
pub fn get_next_animation_id(self) -> PixooCommandBuilder
sourcepub fn reset_next_animation_id(self) -> PixooCommandBuilder
pub fn reset_next_animation_id(self) -> PixooCommandBuilder
sourcepub fn send_image_animation(
self,
id: i32,
animation: DivoomImageAnimation
) -> PixooCommandBuilder
pub fn send_image_animation(
self,
id: i32,
animation: DivoomImageAnimation
) -> PixooCommandBuilder
Send image animation
This API sends the image animation definitions to Pixoo devices and trigger it play.
To create an animation, the first request to draw the frame should always have with PicOffset
set to 0, because it creates the image, otherwise other request cannot go through correctly.
When using the API in our library, we will ask for the id
in the parameter, which maps to PicId
in the final request. Note that:
- This
id
should be the id that returned byget_next_animation_id
. - If
DIVOOM_IMAGE_ANIMATION_ID_AUTO
is used, we will automatically get the latest animation id and use it.
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=93
This API will generate requests like below:
{
"Command":"Draw/SendHttpGif",
"PicNum":2,
"PicWidth":64,
"PicOffset":0,
"PicID":3,
"PicSpeed":100,
"PicData":"AAIpAAIp..."
}
sourcepub fn send_text_animation(
self,
animation: DivoomTextAnimation
) -> PixooCommandBuilder
pub fn send_text_animation(
self,
animation: DivoomTextAnimation
) -> PixooCommandBuilder
Send text animation
The text animation will only work when the device is in the drawing mode (showing image animation).
If we send text animation when device is showing other things such as clock, the text animation will simply be ignored.
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=219
This API will generate requests like below:
{
"Command":"Draw/SendHttpText",
"TextId":4,
"x":0,
"y":40,
"dir":0,
"font":4,
"TextWidth":56,
"speed":10,
"TextString":"hello, Divoom",
"color":"#FFFF00",
"align":1
}
sourcepub fn clear_all_text_area(self) -> PixooCommandBuilder
pub fn clear_all_text_area(self) -> PixooCommandBuilder
sourcepub fn play_buzzer(
self,
play_total_time: i32,
active_time_in_cycle: i32,
off_time_in_cycle: i32
) -> PixooCommandBuilder
pub fn play_buzzer(
self,
play_total_time: i32,
active_time_in_cycle: i32,
off_time_in_cycle: i32
) -> PixooCommandBuilder
Play buzzer
Trigger buzzer to make some beeps sound:
NOTE: For Pixoo-64 device, every buzz is about 50ms long and the device cannot handle request <100ms very well. Hence:
- For active time longer than 100ms, it will play buzz in each cycle multiple times.
- If we set active time smaller than 50ms or off time smaller than 100ms, it might not buzz or off at all.
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=347
This API will generate requests like below:
{
"Command":"Device/PlayTFGif",
"ActiveTimeInCycle": 500,
"OffTimeInCycle": 500,
"PlayTotalTime": 3000
}
sourceimpl PixooCommandBuilder
impl PixooCommandBuilder
Batch API implementations
sourcepub fn execute_commands_from_url(
self,
command_url: String
) -> PixooCommandBuilder
pub fn execute_commands_from_url(
self,
command_url: String
) -> PixooCommandBuilder
Execute URL from text file URL
Official doc: http://doc.divoom-gz.com/web/#/12?page_id=242
This API will generate requests like below:
{
"Command":"Draw/UseHTTPCommandSource",
"CommandUrl": "http://f.divoom-gz.com/all_command.txt"
}
sourceimpl PixooCommandBuilder
impl PixooCommandBuilder
Raw API implementations
pub fn send_raw_request(self, request: String) -> PixooCommandBuilder
Auto Trait Implementations
impl !RefUnwindSafe for PixooCommandBuilder
impl Send for PixooCommandBuilder
impl Sync for PixooCommandBuilder
impl Unpin for PixooCommandBuilder
impl !UnwindSafe for PixooCommandBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more