pub struct PixooClient { /* private fields */ }
Expand description

Pixoo device client

Once we have the IP address of the device, we can create the client and start to execute command directly:

use divoom::*;
let pixoo = PixooClient::new("192.168.0.123");
// let result = pixoo.get_current_channel().await?;
// println!("{:?}", result);

Implementations

Ctor

Select channel

Official doc: http://doc.divoom-gz.com/web/#/12?page_id=89

The channel is the top category of the display content.

Get selected clock id

Official doc: http://doc.divoom-gz.com/web/#/12?page_id=239

Sample response:

{
   "ClockId": 12,
   "Brightness":100
}
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
}
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"
}
Set system time

Official doc: http://doc.divoom-gz.com/web/#/12?page_id=222

Sample request:

{
  "Command":"Device/SetUTC",
  "Utc": 1672416000
}
Set high light mode

Official doc: http://doc.divoom-gz.com/web/#/12?page_id=342

Sample request:

{
  "Command": "Device/SetHighLightMode",
  "Mode": 0
}
Set hour mode

Official doc: http://doc.divoom-gz.com/web/#/12?page_id=341

Sample request:

{
  "Command": "Device/SetTime24Flag",
  "Mode": 0
}
Set mirror mode

Official doc: http://doc.divoom-gz.com/web/#/12?page_id=340

Sample request:

{
  "Command": "Device/SetMirrorMode",
  "Mode": 0
}
Set rotation angle

Official doc: http://doc.divoom-gz.com/web/#/12?page_id=339

Sample request:

{
  "Command": "Device/SetScreenRotationAngle",
  "Mode": 0
}
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
}
Set temperature unit

Official doc: http://doc.divoom-gz.com/web/#/12?page_id=338

Sample request:

{
  "Command":"Device/SetDisTempMode",
  "Mode":0
}
Set time zone

Official doc: http://doc.divoom-gz.com/web/#/12?page_id=221

Sample request:

{
  "Command":"Sys/TimeZone",
  "TimeZoneValue": "GMT-5"
}
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"
}
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
}
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
}
Set noise tool

Official doc: http://doc.divoom-gz.com/web/#/12?page_id=227

Sample request:

{
  "Command":"Tools/SetNoiseStatus",
  "NoiseStatus": 1
}
Set scroeboard tool

Official doc: http://doc.divoom-gz.com/web/#/12?page_id=226

Sample request:

{
  "Command":"Tools/SetScoreBoard",
  "BlueScore": 100,
  "RedScore": 79
}
Set stopwatch tool

Official doc: http://doc.divoom-gz.com/web/#/12?page_id=225

Sample request:

{
  "Command":"Tools/SetStopWatch",
  "Status": 1
}
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"
}

Send GIF to the device to play as an animation.

This API is different from play_gif_file, which is provided by divoom device directly. This API will try to leverage the animation API, create a new animation, load the gif files and draw all the frames into the animation, and send the to device to play.

The API play_gif_file doesn’t seems to be very stable when the package is published, hence send_gif_as_animation is more preferred as of now.

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 by get_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..."
}
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 by get_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..."
}
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
}
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
}
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"
}
Batch mode

This function returns the command builder, which allows us to build multiple commands and execute them at once.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more