cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

USB mount/remove commands via PLC

USB mount/remove commands via PLC

alink
New Contributor

Hello,

is there a way to mount/remove an USB device connected at XF01 (CoreX3) via PLC commands?

Just found ways with Node-Red.

Because all things like detecting an USB, read and write files, and so on, ware possible with PLC commands.

In any way I want to avoid using different programing which only makes punsh of functions and ends in a mixed up result.

It would be a great pleasure if doing this

alink_0-1710863920846.png

and maybe this

alink_1-1710863980158.png

with PLCcommands only.

Are there any hints?

Thanks

 

6 REPLIES 6

Sgilk
Contributor

Hello @alink ,

Yes, all of this should be possible using the cltrX Storage API. You will need to implement a REST client in the PLC to make these requests. You can view the endpoints and play around with making REST calls in the interactive Swagger UI documentation. You can access this via the ctrlX OS web interface.

Example:

Sgilk_0-1710871905296.png

alink
New Contributor

Hello @Sgilk 

thanks for reply. Maybe I forget to mention but it should be possible with a own visu. There I'd like to set a PLC command to mount / remove a USB device. Because to copy files from PLC to USB or USB to PLC is working fine. But it is nonsense when it is not possible to "mount" / "remove" the device with PLC commands. And I really don't want that customer uses ctrlX Web Interface or that I have to use other tools to program any action for this.

CodeShepherd
Community Moderator
Community Moderator

As an addition to @Sgilk The mentioned interface above are not limited to be used via our web UI but are describing standardised REST APIs that can be triggered/used from anywhere. E.g. also from PLC.

The API description can be easily found via the ctrlX OS web UI. 

alink
New Contributor

Right now,  I found another way to get it working. It's not what I'd like to have but good enough to have a first solution:

With my own Visu (CoDeSys WebVisu) I placed the "webbrowser" element and browse to ctrlX OS Web infterface.

alink_0-1711544661695.png

In ctrlX OS Web Interface there is a new user "user" with restricted permission just to manage "storage".

There the user can "mount"/"remove" a USB storage device.

alink_1-1711544792370.png

With that, I reached what I wanted to have:

-Customer / user musn't start a webbrowser or call another page

-Customer / user can do it from my Visu

-No further code, software, program or anything is needed

What I don't like:

-Customer has contact with base system (ctrlX). Thanks to limited permissions it should be save but who knows what customer does intendend/unintendend

@CodeShepherd are there any plans to implement the function in DataLayer? Because status request is possible, giving commands like mount and remove would be great and makes it much easier and safer (not for me, for my customers).

Thanks guys for hints and help

 

@alink ,

This is exactly the idea behind the REST API. When you are clicking in the web interface via your browser, REST API calls are made behind the scenes. You can do the same thing in PLC code without requiring the user to click through.

CodeShepherd
Community Moderator
Community Moderator

There are no plans to introduce such functionality in the data layer, as far as I know. But like also mentioned above simply use the cltrX Storage API.

Steps to go:

  • Use a PLC library able of querying https requests
  • get a bearer token
  • use cltrX Storage API
Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist